2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
4 #include "org_ldk_impl_bindings.h"
10 #define LIKELY(v) __builtin_expect(!!(v), 1)
11 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define MALLOC(a, _) malloc(a)
15 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
16 #define CHECK_ACCESS(p)
17 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
18 #define DO_ASSERT(a) (void)(a)
21 static jmethodID ordinal_meth = NULL;
22 static jmethodID slicedef_meth = NULL;
23 static jclass slicedef_cls = NULL;
24 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
25 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
26 CHECK(ordinal_meth != NULL);
27 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
28 CHECK(slicedef_meth != NULL);
29 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
30 CHECK(slicedef_cls != NULL);
33 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
36 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
39 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
43 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
44 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
47 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
48 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
49 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
50 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
53 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
54 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
55 vec->datalen = (*env)->GetArrayLength(env, bytes);
56 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
57 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
60 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
61 LDKTransaction *txdata = (LDKTransaction*)ptr;
63 slice.data = txdata->data;
64 slice.datalen = txdata->datalen;
65 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
67 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
68 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
69 txdata->datalen = (*env)->GetArrayLength(env, bytes);
70 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
71 txdata->data_is_owned = false;
72 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
73 return (uint64_t)txdata;
75 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
76 LDKTransaction *tx = (LDKTransaction*)ptr;
77 tx->data_is_owned = true;
78 Transaction_free(*tx);
81 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
82 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
83 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
84 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
85 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
86 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
87 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
88 return (uint64_t)vec->datalen;
90 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
91 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
92 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
93 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
94 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
96 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
102 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
103 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
105 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
108 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
109 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
111 typedef jlongArray int64_tArray;
112 typedef jbyteArray int8_tArray;
114 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
115 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
116 char* conv_buf = MALLOC(len + 1, "str conv buf");
117 memcpy(conv_buf, chars, len);
119 jstring ret = (*env)->NewStringUTF(env, conv_buf);
123 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
124 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
125 char* newchars = MALLOC(str_len + 1, "String chars");
126 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
127 memcpy(newchars, jchars, str_len);
128 newchars[str_len] = 0;
129 (*env)->ReleaseStringUTFChars(env, str, jchars);
133 .chars_is_owned = true
138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
139 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
141 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
142 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
145 static jclass arr_of_B_clz = NULL;
146 static jclass arr_of_J_clz = NULL;
147 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
148 arr_of_B_clz = (*env)->FindClass(env, "[B");
149 CHECK(arr_of_B_clz != NULL);
150 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
151 arr_of_J_clz = (*env)->FindClass(env, "[J");
152 CHECK(arr_of_J_clz != NULL);
153 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
155 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
156 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
157 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
158 if (UNLIKELY((*env)->ExceptionCheck(env))) {
159 (*env)->ExceptionDescribe(env);
160 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception.");
163 case 0: return LDKAccessError_UnknownChain;
164 case 1: return LDKAccessError_UnknownTx;
166 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value.");
167 abort(); // Unreachable, but will let the compiler know we don't return here
169 static jclass AccessError_class = NULL;
170 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
171 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
172 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
173 AccessError_class = (*env)->NewGlobalRef(env, clz);
174 CHECK(AccessError_class != NULL);
175 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
176 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
177 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
178 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
180 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
182 case LDKAccessError_UnknownChain:
183 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
184 case LDKAccessError_UnknownTx:
185 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
190 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
191 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
192 if (UNLIKELY((*env)->ExceptionCheck(env))) {
193 (*env)->ExceptionDescribe(env);
194 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
197 case 0: return LDKCOption_NoneZ_Some;
198 case 1: return LDKCOption_NoneZ_None;
200 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
201 abort(); // Unreachable, but will let the compiler know we don't return here
203 static jclass COption_NoneZ_class = NULL;
204 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
205 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
206 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
207 COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
208 CHECK(COption_NoneZ_class != NULL);
209 COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
210 CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
211 COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
212 CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
214 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
216 case LDKCOption_NoneZ_Some:
217 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
218 case LDKCOption_NoneZ_None:
219 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
224 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
225 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
226 if (UNLIKELY((*env)->ExceptionCheck(env))) {
227 (*env)->ExceptionDescribe(env);
228 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception.");
231 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
232 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
234 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value.");
235 abort(); // Unreachable, but will let the compiler know we don't return here
237 static jclass ChannelMonitorUpdateErr_class = NULL;
238 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
239 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
240 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
241 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
242 CHECK(ChannelMonitorUpdateErr_class != NULL);
243 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
244 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
245 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
246 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
248 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
250 case LDKChannelMonitorUpdateErr_TemporaryFailure:
251 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
252 case LDKChannelMonitorUpdateErr_PermanentFailure:
253 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
258 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
259 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
260 if (UNLIKELY((*env)->ExceptionCheck(env))) {
261 (*env)->ExceptionDescribe(env);
262 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
265 case 0: return LDKConfirmationTarget_Background;
266 case 1: return LDKConfirmationTarget_Normal;
267 case 2: return LDKConfirmationTarget_HighPriority;
269 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
270 abort(); // Unreachable, but will let the compiler know we don't return here
272 static jclass ConfirmationTarget_class = NULL;
273 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
274 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
275 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
276 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
277 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
278 CHECK(ConfirmationTarget_class != NULL);
279 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
280 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
281 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
282 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
283 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
284 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
286 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
288 case LDKConfirmationTarget_Background:
289 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
290 case LDKConfirmationTarget_Normal:
291 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
292 case LDKConfirmationTarget_HighPriority:
293 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
298 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
299 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
300 if (UNLIKELY((*env)->ExceptionCheck(env))) {
301 (*env)->ExceptionDescribe(env);
302 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
305 case 0: return LDKCreationError_DescriptionTooLong;
306 case 1: return LDKCreationError_RouteTooLong;
307 case 2: return LDKCreationError_TimestampOutOfBounds;
308 case 3: return LDKCreationError_InvalidAmount;
309 case 4: return LDKCreationError_MissingRouteHints;
311 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
312 abort(); // Unreachable, but will let the compiler know we don't return here
314 static jclass CreationError_class = NULL;
315 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
316 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
317 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
318 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
319 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
320 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
321 CreationError_class = (*env)->NewGlobalRef(env, clz);
322 CHECK(CreationError_class != NULL);
323 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
324 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
325 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
326 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
327 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
328 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
329 CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
330 CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
331 CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
332 CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
334 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
336 case LDKCreationError_DescriptionTooLong:
337 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
338 case LDKCreationError_RouteTooLong:
339 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
340 case LDKCreationError_TimestampOutOfBounds:
341 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
342 case LDKCreationError_InvalidAmount:
343 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
344 case LDKCreationError_MissingRouteHints:
345 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
350 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
351 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
352 if (UNLIKELY((*env)->ExceptionCheck(env))) {
353 (*env)->ExceptionDescribe(env);
354 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
357 case 0: return LDKCurrency_Bitcoin;
358 case 1: return LDKCurrency_BitcoinTestnet;
359 case 2: return LDKCurrency_Regtest;
360 case 3: return LDKCurrency_Simnet;
361 case 4: return LDKCurrency_Signet;
363 (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
364 abort(); // Unreachable, but will let the compiler know we don't return here
366 static jclass Currency_class = NULL;
367 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
368 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
369 static jfieldID Currency_LDKCurrency_Regtest = NULL;
370 static jfieldID Currency_LDKCurrency_Simnet = NULL;
371 static jfieldID Currency_LDKCurrency_Signet = NULL;
372 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
373 Currency_class = (*env)->NewGlobalRef(env, clz);
374 CHECK(Currency_class != NULL);
375 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
376 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
377 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
378 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
379 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
380 CHECK(Currency_LDKCurrency_Regtest != NULL);
381 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
382 CHECK(Currency_LDKCurrency_Simnet != NULL);
383 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
384 CHECK(Currency_LDKCurrency_Signet != NULL);
386 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
388 case LDKCurrency_Bitcoin:
389 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
390 case LDKCurrency_BitcoinTestnet:
391 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
392 case LDKCurrency_Regtest:
393 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
394 case LDKCurrency_Simnet:
395 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
396 case LDKCurrency_Signet:
397 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
402 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
403 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
404 if (UNLIKELY((*env)->ExceptionCheck(env))) {
405 (*env)->ExceptionDescribe(env);
406 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
409 case 0: return LDKIOError_NotFound;
410 case 1: return LDKIOError_PermissionDenied;
411 case 2: return LDKIOError_ConnectionRefused;
412 case 3: return LDKIOError_ConnectionReset;
413 case 4: return LDKIOError_ConnectionAborted;
414 case 5: return LDKIOError_NotConnected;
415 case 6: return LDKIOError_AddrInUse;
416 case 7: return LDKIOError_AddrNotAvailable;
417 case 8: return LDKIOError_BrokenPipe;
418 case 9: return LDKIOError_AlreadyExists;
419 case 10: return LDKIOError_WouldBlock;
420 case 11: return LDKIOError_InvalidInput;
421 case 12: return LDKIOError_InvalidData;
422 case 13: return LDKIOError_TimedOut;
423 case 14: return LDKIOError_WriteZero;
424 case 15: return LDKIOError_Interrupted;
425 case 16: return LDKIOError_Other;
426 case 17: return LDKIOError_UnexpectedEof;
428 (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
429 abort(); // Unreachable, but will let the compiler know we don't return here
431 static jclass IOError_class = NULL;
432 static jfieldID IOError_LDKIOError_NotFound = NULL;
433 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
434 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
435 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
436 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
437 static jfieldID IOError_LDKIOError_NotConnected = NULL;
438 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
439 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
440 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
441 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
442 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
443 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
444 static jfieldID IOError_LDKIOError_InvalidData = NULL;
445 static jfieldID IOError_LDKIOError_TimedOut = NULL;
446 static jfieldID IOError_LDKIOError_WriteZero = NULL;
447 static jfieldID IOError_LDKIOError_Interrupted = NULL;
448 static jfieldID IOError_LDKIOError_Other = NULL;
449 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
450 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
451 IOError_class = (*env)->NewGlobalRef(env, clz);
452 CHECK(IOError_class != NULL);
453 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
454 CHECK(IOError_LDKIOError_NotFound != NULL);
455 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
456 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
457 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
458 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
459 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
460 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
461 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
462 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
463 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
464 CHECK(IOError_LDKIOError_NotConnected != NULL);
465 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
466 CHECK(IOError_LDKIOError_AddrInUse != NULL);
467 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
468 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
469 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
470 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
471 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
472 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
473 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
474 CHECK(IOError_LDKIOError_WouldBlock != NULL);
475 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
476 CHECK(IOError_LDKIOError_InvalidInput != NULL);
477 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
478 CHECK(IOError_LDKIOError_InvalidData != NULL);
479 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
480 CHECK(IOError_LDKIOError_TimedOut != NULL);
481 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
482 CHECK(IOError_LDKIOError_WriteZero != NULL);
483 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
484 CHECK(IOError_LDKIOError_Interrupted != NULL);
485 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
486 CHECK(IOError_LDKIOError_Other != NULL);
487 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
488 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
490 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
492 case LDKIOError_NotFound:
493 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
494 case LDKIOError_PermissionDenied:
495 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
496 case LDKIOError_ConnectionRefused:
497 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
498 case LDKIOError_ConnectionReset:
499 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
500 case LDKIOError_ConnectionAborted:
501 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
502 case LDKIOError_NotConnected:
503 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
504 case LDKIOError_AddrInUse:
505 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
506 case LDKIOError_AddrNotAvailable:
507 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
508 case LDKIOError_BrokenPipe:
509 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
510 case LDKIOError_AlreadyExists:
511 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
512 case LDKIOError_WouldBlock:
513 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
514 case LDKIOError_InvalidInput:
515 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
516 case LDKIOError_InvalidData:
517 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
518 case LDKIOError_TimedOut:
519 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
520 case LDKIOError_WriteZero:
521 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
522 case LDKIOError_Interrupted:
523 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
524 case LDKIOError_Other:
525 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
526 case LDKIOError_UnexpectedEof:
527 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
532 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
533 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
534 if (UNLIKELY((*env)->ExceptionCheck(env))) {
535 (*env)->ExceptionDescribe(env);
536 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
539 case 0: return LDKLevel_Gossip;
540 case 1: return LDKLevel_Trace;
541 case 2: return LDKLevel_Debug;
542 case 3: return LDKLevel_Info;
543 case 4: return LDKLevel_Warn;
544 case 5: return LDKLevel_Error;
546 (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
547 abort(); // Unreachable, but will let the compiler know we don't return here
549 static jclass Level_class = NULL;
550 static jfieldID Level_LDKLevel_Gossip = NULL;
551 static jfieldID Level_LDKLevel_Trace = NULL;
552 static jfieldID Level_LDKLevel_Debug = NULL;
553 static jfieldID Level_LDKLevel_Info = NULL;
554 static jfieldID Level_LDKLevel_Warn = NULL;
555 static jfieldID Level_LDKLevel_Error = NULL;
556 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
557 Level_class = (*env)->NewGlobalRef(env, clz);
558 CHECK(Level_class != NULL);
559 Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
560 CHECK(Level_LDKLevel_Gossip != NULL);
561 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
562 CHECK(Level_LDKLevel_Trace != NULL);
563 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
564 CHECK(Level_LDKLevel_Debug != NULL);
565 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
566 CHECK(Level_LDKLevel_Info != NULL);
567 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
568 CHECK(Level_LDKLevel_Warn != NULL);
569 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
570 CHECK(Level_LDKLevel_Error != NULL);
572 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
574 case LDKLevel_Gossip:
575 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
577 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
579 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
581 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
583 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
585 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
590 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
591 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
592 if (UNLIKELY((*env)->ExceptionCheck(env))) {
593 (*env)->ExceptionDescribe(env);
594 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
597 case 0: return LDKNetwork_Bitcoin;
598 case 1: return LDKNetwork_Testnet;
599 case 2: return LDKNetwork_Regtest;
600 case 3: return LDKNetwork_Signet;
602 (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
603 abort(); // Unreachable, but will let the compiler know we don't return here
605 static jclass Network_class = NULL;
606 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
607 static jfieldID Network_LDKNetwork_Testnet = NULL;
608 static jfieldID Network_LDKNetwork_Regtest = NULL;
609 static jfieldID Network_LDKNetwork_Signet = NULL;
610 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
611 Network_class = (*env)->NewGlobalRef(env, clz);
612 CHECK(Network_class != NULL);
613 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
614 CHECK(Network_LDKNetwork_Bitcoin != NULL);
615 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
616 CHECK(Network_LDKNetwork_Testnet != NULL);
617 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
618 CHECK(Network_LDKNetwork_Regtest != NULL);
619 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
620 CHECK(Network_LDKNetwork_Signet != NULL);
622 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
624 case LDKNetwork_Bitcoin:
625 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
626 case LDKNetwork_Testnet:
627 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
628 case LDKNetwork_Regtest:
629 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
630 case LDKNetwork_Signet:
631 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
636 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
637 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
638 if (UNLIKELY((*env)->ExceptionCheck(env))) {
639 (*env)->ExceptionDescribe(env);
640 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
643 case 0: return LDKRecipient_Node;
644 case 1: return LDKRecipient_PhantomNode;
646 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
647 abort(); // Unreachable, but will let the compiler know we don't return here
649 static jclass Recipient_class = NULL;
650 static jfieldID Recipient_LDKRecipient_Node = NULL;
651 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
652 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
653 Recipient_class = (*env)->NewGlobalRef(env, clz);
654 CHECK(Recipient_class != NULL);
655 Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
656 CHECK(Recipient_LDKRecipient_Node != NULL);
657 Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
658 CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
660 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
662 case LDKRecipient_Node:
663 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
664 case LDKRecipient_PhantomNode:
665 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
670 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
671 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
672 if (UNLIKELY((*env)->ExceptionCheck(env))) {
673 (*env)->ExceptionDescribe(env);
674 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
677 case 0: return LDKSecp256k1Error_IncorrectSignature;
678 case 1: return LDKSecp256k1Error_InvalidMessage;
679 case 2: return LDKSecp256k1Error_InvalidPublicKey;
680 case 3: return LDKSecp256k1Error_InvalidSignature;
681 case 4: return LDKSecp256k1Error_InvalidSecretKey;
682 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
683 case 6: return LDKSecp256k1Error_InvalidTweak;
684 case 7: return LDKSecp256k1Error_TweakCheckFailed;
685 case 8: return LDKSecp256k1Error_NotEnoughMemory;
687 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
688 abort(); // Unreachable, but will let the compiler know we don't return here
690 static jclass Secp256k1Error_class = NULL;
691 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
692 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
693 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
694 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
695 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
696 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
697 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
698 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
699 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
700 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
701 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
702 CHECK(Secp256k1Error_class != NULL);
703 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
704 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
705 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
706 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
707 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
708 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
709 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
710 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
711 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
712 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
713 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
714 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
715 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
716 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
717 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
718 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
719 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
720 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
722 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
724 case LDKSecp256k1Error_IncorrectSignature:
725 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
726 case LDKSecp256k1Error_InvalidMessage:
727 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
728 case LDKSecp256k1Error_InvalidPublicKey:
729 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
730 case LDKSecp256k1Error_InvalidSignature:
731 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
732 case LDKSecp256k1Error_InvalidSecretKey:
733 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
734 case LDKSecp256k1Error_InvalidRecoveryId:
735 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
736 case LDKSecp256k1Error_InvalidTweak:
737 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
738 case LDKSecp256k1Error_TweakCheckFailed:
739 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
740 case LDKSecp256k1Error_NotEnoughMemory:
741 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
746 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
747 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
748 if (UNLIKELY((*env)->ExceptionCheck(env))) {
749 (*env)->ExceptionDescribe(env);
750 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
753 case 0: return LDKSemanticError_NoPaymentHash;
754 case 1: return LDKSemanticError_MultiplePaymentHashes;
755 case 2: return LDKSemanticError_NoDescription;
756 case 3: return LDKSemanticError_MultipleDescriptions;
757 case 4: return LDKSemanticError_NoPaymentSecret;
758 case 5: return LDKSemanticError_MultiplePaymentSecrets;
759 case 6: return LDKSemanticError_InvalidFeatures;
760 case 7: return LDKSemanticError_InvalidRecoveryId;
761 case 8: return LDKSemanticError_InvalidSignature;
762 case 9: return LDKSemanticError_ImpreciseAmount;
764 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
765 abort(); // Unreachable, but will let the compiler know we don't return here
767 static jclass SemanticError_class = NULL;
768 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
769 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
770 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
771 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
772 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
773 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
774 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
775 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
776 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
777 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
778 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
779 SemanticError_class = (*env)->NewGlobalRef(env, clz);
780 CHECK(SemanticError_class != NULL);
781 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
782 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
783 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
784 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
785 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
786 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
787 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
788 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
789 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
790 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
791 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
792 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
793 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
794 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
795 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
796 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
797 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
798 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
799 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
800 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
802 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
804 case LDKSemanticError_NoPaymentHash:
805 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
806 case LDKSemanticError_MultiplePaymentHashes:
807 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
808 case LDKSemanticError_NoDescription:
809 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
810 case LDKSemanticError_MultipleDescriptions:
811 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
812 case LDKSemanticError_NoPaymentSecret:
813 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
814 case LDKSemanticError_MultiplePaymentSecrets:
815 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
816 case LDKSemanticError_InvalidFeatures:
817 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
818 case LDKSemanticError_InvalidRecoveryId:
819 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
820 case LDKSemanticError_InvalidSignature:
821 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
822 case LDKSemanticError_ImpreciseAmount:
823 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
828 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
829 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
830 if (UNLIKELY((*env)->ExceptionCheck(env))) {
831 (*env)->ExceptionDescribe(env);
832 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
835 case 0: return LDKSiPrefix_Milli;
836 case 1: return LDKSiPrefix_Micro;
837 case 2: return LDKSiPrefix_Nano;
838 case 3: return LDKSiPrefix_Pico;
840 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
841 abort(); // Unreachable, but will let the compiler know we don't return here
843 static jclass SiPrefix_class = NULL;
844 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
845 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
846 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
847 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
848 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
849 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
850 CHECK(SiPrefix_class != NULL);
851 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
852 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
853 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
854 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
855 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
856 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
857 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
858 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
860 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
862 case LDKSiPrefix_Milli:
863 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
864 case LDKSiPrefix_Micro:
865 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
866 case LDKSiPrefix_Nano:
867 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
868 case LDKSiPrefix_Pico:
869 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
874 static jclass LDKBech32Error_MissingSeparator_class = NULL;
875 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
876 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
877 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
878 static jclass LDKBech32Error_InvalidLength_class = NULL;
879 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
880 static jclass LDKBech32Error_InvalidChar_class = NULL;
881 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
882 static jclass LDKBech32Error_InvalidData_class = NULL;
883 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
884 static jclass LDKBech32Error_InvalidPadding_class = NULL;
885 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
886 static jclass LDKBech32Error_MixedCase_class = NULL;
887 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
889 LDKBech32Error_MissingSeparator_class =
890 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
891 CHECK(LDKBech32Error_MissingSeparator_class != NULL);
892 LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
893 CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
894 LDKBech32Error_InvalidChecksum_class =
895 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
896 CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
897 LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
898 CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
899 LDKBech32Error_InvalidLength_class =
900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
901 CHECK(LDKBech32Error_InvalidLength_class != NULL);
902 LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
903 CHECK(LDKBech32Error_InvalidLength_meth != NULL);
904 LDKBech32Error_InvalidChar_class =
905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
906 CHECK(LDKBech32Error_InvalidChar_class != NULL);
907 LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
908 CHECK(LDKBech32Error_InvalidChar_meth != NULL);
909 LDKBech32Error_InvalidData_class =
910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
911 CHECK(LDKBech32Error_InvalidData_class != NULL);
912 LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
913 CHECK(LDKBech32Error_InvalidData_meth != NULL);
914 LDKBech32Error_InvalidPadding_class =
915 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
916 CHECK(LDKBech32Error_InvalidPadding_class != NULL);
917 LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
918 CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
919 LDKBech32Error_MixedCase_class =
920 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
921 CHECK(LDKBech32Error_MixedCase_class != NULL);
922 LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
923 CHECK(LDKBech32Error_MixedCase_meth != NULL);
925 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
926 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
928 case LDKBech32Error_MissingSeparator: {
929 return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
931 case LDKBech32Error_InvalidChecksum: {
932 return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
934 case LDKBech32Error_InvalidLength: {
935 return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
937 case LDKBech32Error_InvalidChar: {
938 return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, obj->invalid_char);
940 case LDKBech32Error_InvalidData: {
941 return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, obj->invalid_data);
943 case LDKBech32Error_InvalidPadding: {
944 return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
946 case LDKBech32Error_MixedCase: {
947 return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
952 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
953 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
954 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
957 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) {
958 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
959 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
960 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
961 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
962 CVec_u8Z_free(ret_var);
966 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) {
967 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
968 int64_t ret_val = TxOut_get_value(thing_conv);
972 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
973 CHECK(owner->result_ok);
974 return *owner->contents.result;
976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
977 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
978 CResult_NoneNoneZ_get_ok(owner_conv);
981 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
982 CHECK(!owner->result_ok);
983 return *owner->contents.err;
985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
986 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
987 CResult_NoneNoneZ_get_err(owner_conv);
990 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
991 CHECK(owner->result_ok);
992 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
995 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
996 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_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_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *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_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1013 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
1014 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_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 LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1027 CHECK(owner->result_ok);
1028 return *owner->contents.result;
1030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1031 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1032 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1033 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1037 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1038 CHECK(!owner->result_ok);
1039 return *owner->contents.err;
1041 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1042 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1043 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1047 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1048 CHECK(owner->result_ok);
1049 return *owner->contents.result;
1051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1052 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1053 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1054 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1058 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1059 CHECK(!owner->result_ok);
1060 return *owner->contents.err;
1062 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1063 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1064 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1068 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1069 CHECK(owner->result_ok);
1070 return TxCreationKeys_clone(&*owner->contents.result);
1072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1073 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1074 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1075 int64_t ret_ref = 0;
1076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1079 ret_ref = (uintptr_t)ret_var.inner;
1080 if (ret_var.is_owned) {
1086 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1087 CHECK(!owner->result_ok);
1088 return DecodeError_clone(&*owner->contents.err);
1090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1091 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1092 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1093 int64_t ret_ref = 0;
1094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1097 ret_ref = (uintptr_t)ret_var.inner;
1098 if (ret_var.is_owned) {
1104 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1105 CHECK(owner->result_ok);
1106 return ChannelPublicKeys_clone(&*owner->contents.result);
1108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1109 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1110 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1111 int64_t ret_ref = 0;
1112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1115 ret_ref = (uintptr_t)ret_var.inner;
1116 if (ret_var.is_owned) {
1122 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1123 CHECK(!owner->result_ok);
1124 return DecodeError_clone(&*owner->contents.err);
1126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1127 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1128 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1129 int64_t ret_ref = 0;
1130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1133 ret_ref = (uintptr_t)ret_var.inner;
1134 if (ret_var.is_owned) {
1140 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1141 CHECK(owner->result_ok);
1142 return TxCreationKeys_clone(&*owner->contents.result);
1144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1145 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1146 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1147 int64_t ret_ref = 0;
1148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1151 ret_ref = (uintptr_t)ret_var.inner;
1152 if (ret_var.is_owned) {
1158 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1159 CHECK(!owner->result_ok);
1160 return *owner->contents.err;
1162 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1163 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1164 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1168 static jclass LDKCOption_u32Z_Some_class = NULL;
1169 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1170 static jclass LDKCOption_u32Z_None_class = NULL;
1171 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1173 LDKCOption_u32Z_Some_class =
1174 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1175 CHECK(LDKCOption_u32Z_Some_class != NULL);
1176 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1177 CHECK(LDKCOption_u32Z_Some_meth != NULL);
1178 LDKCOption_u32Z_None_class =
1179 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1180 CHECK(LDKCOption_u32Z_None_class != NULL);
1181 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1182 CHECK(LDKCOption_u32Z_None_meth != NULL);
1184 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1185 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
1187 case LDKCOption_u32Z_Some: {
1188 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
1190 case LDKCOption_u32Z_None: {
1191 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1196 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1197 CHECK(owner->result_ok);
1198 return HTLCOutputInCommitment_clone(&*owner->contents.result);
1200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1201 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1202 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1203 int64_t ret_ref = 0;
1204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1207 ret_ref = (uintptr_t)ret_var.inner;
1208 if (ret_var.is_owned) {
1214 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1215 CHECK(!owner->result_ok);
1216 return DecodeError_clone(&*owner->contents.err);
1218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1219 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1220 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1221 int64_t ret_ref = 0;
1222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1225 ret_ref = (uintptr_t)ret_var.inner;
1226 if (ret_var.is_owned) {
1232 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1233 CHECK(owner->result_ok);
1234 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1237 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1238 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1239 int64_t ret_ref = 0;
1240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1243 ret_ref = (uintptr_t)ret_var.inner;
1244 if (ret_var.is_owned) {
1250 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1251 CHECK(!owner->result_ok);
1252 return DecodeError_clone(&*owner->contents.err);
1254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1255 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1256 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1257 int64_t ret_ref = 0;
1258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1261 ret_ref = (uintptr_t)ret_var.inner;
1262 if (ret_var.is_owned) {
1268 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1269 CHECK(owner->result_ok);
1270 return ChannelTransactionParameters_clone(&*owner->contents.result);
1272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1273 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1274 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1275 int64_t ret_ref = 0;
1276 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1277 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1279 ret_ref = (uintptr_t)ret_var.inner;
1280 if (ret_var.is_owned) {
1286 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1287 CHECK(!owner->result_ok);
1288 return DecodeError_clone(&*owner->contents.err);
1290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1291 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1292 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1293 int64_t ret_ref = 0;
1294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1297 ret_ref = (uintptr_t)ret_var.inner;
1298 if (ret_var.is_owned) {
1304 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1305 CHECK(owner->result_ok);
1306 return HolderCommitmentTransaction_clone(&*owner->contents.result);
1308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1309 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1310 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1311 int64_t ret_ref = 0;
1312 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1313 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1315 ret_ref = (uintptr_t)ret_var.inner;
1316 if (ret_var.is_owned) {
1322 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1323 CHECK(!owner->result_ok);
1324 return DecodeError_clone(&*owner->contents.err);
1326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1327 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1328 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(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 LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1341 CHECK(owner->result_ok);
1342 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1345 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1346 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(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 LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1359 CHECK(!owner->result_ok);
1360 return DecodeError_clone(&*owner->contents.err);
1362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1363 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1364 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(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;
1370 if (ret_var.is_owned) {
1376 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1377 CHECK(owner->result_ok);
1378 return &*owner->contents.result;
1380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1381 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1382 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1383 int64_t ret_ref = 0;
1384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1387 ret_ref = (uintptr_t)ret_var.inner & ~1;
1391 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1392 CHECK(!owner->result_ok);
1393 return *owner->contents.err;
1395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1396 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1397 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1400 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1401 CHECK(owner->result_ok);
1402 return CommitmentTransaction_clone(&*owner->contents.result);
1404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1405 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1406 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1407 int64_t ret_ref = 0;
1408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1411 ret_ref = (uintptr_t)ret_var.inner;
1412 if (ret_var.is_owned) {
1418 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1419 CHECK(!owner->result_ok);
1420 return DecodeError_clone(&*owner->contents.err);
1422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1423 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1424 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1425 int64_t ret_ref = 0;
1426 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1427 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1429 ret_ref = (uintptr_t)ret_var.inner;
1430 if (ret_var.is_owned) {
1436 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1437 CHECK(owner->result_ok);
1438 return &*owner->contents.result;
1440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1441 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1442 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1443 int64_t ret_ref = 0;
1444 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1445 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1447 ret_ref = (uintptr_t)ret_var.inner & ~1;
1451 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1452 CHECK(!owner->result_ok);
1453 return *owner->contents.err;
1455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1456 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1457 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1460 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1461 CHECK(owner->result_ok);
1462 return *owner->contents.result;
1464 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1465 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1466 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1467 jobjectArray ret_arr = NULL;
1468 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1470 for (size_t i = 0; i < ret_var.datalen; i++) {
1471 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1472 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1473 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1479 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1480 CHECK(!owner->result_ok);
1481 return *owner->contents.err;
1483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1484 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1485 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1488 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1489 CHECK(owner->result_ok);
1490 return ShutdownScript_clone(&*owner->contents.result);
1492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1493 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1494 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1495 int64_t ret_ref = 0;
1496 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1497 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1499 ret_ref = (uintptr_t)ret_var.inner;
1500 if (ret_var.is_owned) {
1506 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1507 CHECK(!owner->result_ok);
1508 return DecodeError_clone(&*owner->contents.err);
1510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1511 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1512 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1513 int64_t ret_ref = 0;
1514 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1515 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1517 ret_ref = (uintptr_t)ret_var.inner;
1518 if (ret_var.is_owned) {
1524 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1525 CHECK(owner->result_ok);
1526 return ShutdownScript_clone(&*owner->contents.result);
1528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1529 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1530 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1531 int64_t ret_ref = 0;
1532 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1533 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1535 ret_ref = (uintptr_t)ret_var.inner;
1536 if (ret_var.is_owned) {
1542 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1543 CHECK(!owner->result_ok);
1544 return InvalidShutdownScript_clone(&*owner->contents.err);
1546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1547 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1548 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1549 int64_t ret_ref = 0;
1550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1553 ret_ref = (uintptr_t)ret_var.inner;
1554 if (ret_var.is_owned) {
1560 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1561 CHECK(owner->result_ok);
1562 return *owner->contents.result;
1564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1565 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1566 CResult_NoneErrorZ_get_ok(owner_conv);
1569 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1570 CHECK(!owner->result_ok);
1571 return *owner->contents.err;
1573 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1574 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1575 jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1579 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1580 CHECK(owner->result_ok);
1581 return RouteHop_clone(&*owner->contents.result);
1583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1584 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1585 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1586 int64_t ret_ref = 0;
1587 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1588 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1590 ret_ref = (uintptr_t)ret_var.inner;
1591 if (ret_var.is_owned) {
1597 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1598 CHECK(!owner->result_ok);
1599 return DecodeError_clone(&*owner->contents.err);
1601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1602 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1603 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1604 int64_t ret_ref = 0;
1605 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1606 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1608 ret_ref = (uintptr_t)ret_var.inner;
1609 if (ret_var.is_owned) {
1615 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1616 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1617 for (size_t i = 0; i < ret.datalen; i++) {
1618 ret.data[i] = RouteHop_clone(&orig->data[i]);
1622 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1623 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1624 for (size_t i = 0; i < ret.datalen; i++) {
1625 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1629 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1630 CHECK(owner->result_ok);
1631 return Route_clone(&*owner->contents.result);
1633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1634 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1635 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1636 int64_t ret_ref = 0;
1637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1640 ret_ref = (uintptr_t)ret_var.inner;
1641 if (ret_var.is_owned) {
1647 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1648 CHECK(!owner->result_ok);
1649 return DecodeError_clone(&*owner->contents.err);
1651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1652 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1653 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1654 int64_t ret_ref = 0;
1655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1658 ret_ref = (uintptr_t)ret_var.inner;
1659 if (ret_var.is_owned) {
1665 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1666 CHECK(owner->result_ok);
1667 return RouteParameters_clone(&*owner->contents.result);
1669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1670 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1671 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1672 int64_t ret_ref = 0;
1673 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1674 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1675 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1676 ret_ref = (uintptr_t)ret_var.inner;
1677 if (ret_var.is_owned) {
1683 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1684 CHECK(!owner->result_ok);
1685 return DecodeError_clone(&*owner->contents.err);
1687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1688 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1689 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1690 int64_t ret_ref = 0;
1691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1694 ret_ref = (uintptr_t)ret_var.inner;
1695 if (ret_var.is_owned) {
1701 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1702 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1703 for (size_t i = 0; i < ret.datalen; i++) {
1704 ret.data[i] = RouteHint_clone(&orig->data[i]);
1708 static jclass LDKCOption_u64Z_Some_class = NULL;
1709 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1710 static jclass LDKCOption_u64Z_None_class = NULL;
1711 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1713 LDKCOption_u64Z_Some_class =
1714 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1715 CHECK(LDKCOption_u64Z_Some_class != NULL);
1716 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1717 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1718 LDKCOption_u64Z_None_class =
1719 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1720 CHECK(LDKCOption_u64Z_None_class != NULL);
1721 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1722 CHECK(LDKCOption_u64Z_None_meth != NULL);
1724 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1725 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1727 case LDKCOption_u64Z_Some: {
1728 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1730 case LDKCOption_u64Z_None: {
1731 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1736 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1737 CHECK(owner->result_ok);
1738 return PaymentParameters_clone(&*owner->contents.result);
1740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1741 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1742 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1743 int64_t ret_ref = 0;
1744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1747 ret_ref = (uintptr_t)ret_var.inner;
1748 if (ret_var.is_owned) {
1754 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1755 CHECK(!owner->result_ok);
1756 return DecodeError_clone(&*owner->contents.err);
1758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1759 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1760 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1761 int64_t ret_ref = 0;
1762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1765 ret_ref = (uintptr_t)ret_var.inner;
1766 if (ret_var.is_owned) {
1772 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1773 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1774 for (size_t i = 0; i < ret.datalen; i++) {
1775 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1779 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1780 CHECK(owner->result_ok);
1781 return RouteHint_clone(&*owner->contents.result);
1783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1784 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1785 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1786 int64_t ret_ref = 0;
1787 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1788 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1789 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1790 ret_ref = (uintptr_t)ret_var.inner;
1791 if (ret_var.is_owned) {
1797 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1798 CHECK(!owner->result_ok);
1799 return DecodeError_clone(&*owner->contents.err);
1801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1802 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1803 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1804 int64_t ret_ref = 0;
1805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1808 ret_ref = (uintptr_t)ret_var.inner;
1809 if (ret_var.is_owned) {
1815 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1816 CHECK(owner->result_ok);
1817 return RouteHintHop_clone(&*owner->contents.result);
1819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1820 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1821 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1822 int64_t ret_ref = 0;
1823 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1824 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1826 ret_ref = (uintptr_t)ret_var.inner;
1827 if (ret_var.is_owned) {
1833 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1834 CHECK(!owner->result_ok);
1835 return DecodeError_clone(&*owner->contents.err);
1837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1838 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1839 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1840 int64_t ret_ref = 0;
1841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1844 ret_ref = (uintptr_t)ret_var.inner;
1845 if (ret_var.is_owned) {
1851 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1852 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1853 for (size_t i = 0; i < ret.datalen; i++) {
1854 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1858 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1859 CHECK(owner->result_ok);
1860 return Route_clone(&*owner->contents.result);
1862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1863 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1864 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1865 int64_t ret_ref = 0;
1866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1869 ret_ref = (uintptr_t)ret_var.inner;
1870 if (ret_var.is_owned) {
1876 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1877 CHECK(!owner->result_ok);
1878 return LightningError_clone(&*owner->contents.err);
1880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1881 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1882 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1883 int64_t ret_ref = 0;
1884 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1885 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1887 ret_ref = (uintptr_t)ret_var.inner;
1888 if (ret_var.is_owned) {
1894 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1895 CHECK(owner->result_ok);
1896 return TxOut_clone(&*owner->contents.result);
1898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1899 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1900 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1901 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
1902 return (int64_t)ret_ref;
1905 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1906 CHECK(!owner->result_ok);
1907 return AccessError_clone(&*owner->contents.err);
1909 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1910 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1911 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
1915 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1919 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1920 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1924 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1928 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1929 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1930 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1931 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1935 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1936 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1937 for (size_t i = 0; i < ret.datalen; i++) {
1938 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1942 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
1943 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1944 for (size_t i = 0; i < ret.datalen; i++) {
1945 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1949 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1950 CHECK(owner->result_ok);
1951 return *owner->contents.result;
1953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1954 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1955 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
1958 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1959 CHECK(!owner->result_ok);
1960 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
1962 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1963 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1964 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
1968 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1969 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1970 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1971 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1972 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
1973 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
1974 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
1975 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
1976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1977 LDKMonitorEvent_HTLCEvent_class =
1978 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
1979 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1980 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1981 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1982 LDKMonitorEvent_CommitmentTxConfirmed_class =
1983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
1984 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1985 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1986 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1987 LDKMonitorEvent_UpdateCompleted_class =
1988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
1989 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
1990 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
1991 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
1992 LDKMonitorEvent_UpdateFailed_class =
1993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
1994 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
1995 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
1996 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
1998 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1999 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2001 case LDKMonitorEvent_HTLCEvent: {
2002 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2003 int64_t htlc_event_ref = 0;
2004 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2005 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2006 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2007 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
2008 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
2010 case LDKMonitorEvent_CommitmentTxConfirmed: {
2011 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2012 int64_t commitment_tx_confirmed_ref = 0;
2013 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2014 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2015 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2016 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
2017 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
2019 case LDKMonitorEvent_UpdateCompleted: {
2020 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2021 int64_t funding_txo_ref = 0;
2022 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2023 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2024 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2025 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
2026 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, obj->update_completed.monitor_update_id);
2028 case LDKMonitorEvent_UpdateFailed: {
2029 LDKOutPoint update_failed_var = obj->update_failed;
2030 int64_t update_failed_ref = 0;
2031 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2032 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2033 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2034 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
2035 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
2040 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2041 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2042 for (size_t i = 0; i < ret.datalen; i++) {
2043 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2047 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
2048 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
2049 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
2050 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
2051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
2052 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
2053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
2054 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
2055 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
2056 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
2057 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
2058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
2059 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
2060 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
2061 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
2063 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2064 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2066 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
2067 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2068 *some_conv = obj->some;
2069 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2070 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((int64_t)some_conv));
2072 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
2073 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
2078 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
2079 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
2080 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
2081 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
2082 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
2083 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
2084 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
2085 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
2086 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
2087 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
2088 static jclass LDKClosureReason_ProcessingError_class = NULL;
2089 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
2090 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
2091 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
2092 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
2093 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
2094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
2095 LDKClosureReason_CounterpartyForceClosed_class =
2096 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
2097 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
2098 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2099 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2100 LDKClosureReason_HolderForceClosed_class =
2101 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2102 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2103 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2104 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2105 LDKClosureReason_CooperativeClosure_class =
2106 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2107 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2108 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2109 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2110 LDKClosureReason_CommitmentTxConfirmed_class =
2111 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2112 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2113 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2114 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2115 LDKClosureReason_FundingTimedOut_class =
2116 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2117 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2118 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2119 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2120 LDKClosureReason_ProcessingError_class =
2121 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2122 CHECK(LDKClosureReason_ProcessingError_class != NULL);
2123 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2124 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2125 LDKClosureReason_DisconnectedPeer_class =
2126 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2127 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2128 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2129 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2130 LDKClosureReason_OutdatedChannelManager_class =
2131 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2132 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2133 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2134 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2136 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2137 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
2139 case LDKClosureReason_CounterpartyForceClosed: {
2140 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2141 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2142 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2144 case LDKClosureReason_HolderForceClosed: {
2145 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2147 case LDKClosureReason_CooperativeClosure: {
2148 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2150 case LDKClosureReason_CommitmentTxConfirmed: {
2151 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2153 case LDKClosureReason_FundingTimedOut: {
2154 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2156 case LDKClosureReason_ProcessingError: {
2157 LDKStr err_str = obj->processing_error.err;
2158 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2159 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2161 case LDKClosureReason_DisconnectedPeer: {
2162 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2164 case LDKClosureReason_OutdatedChannelManager: {
2165 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2170 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2171 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2172 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2173 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2175 LDKCOption_ClosureReasonZ_Some_class =
2176 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2177 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2178 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2179 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2180 LDKCOption_ClosureReasonZ_None_class =
2181 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2182 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2183 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2184 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2186 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2187 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2189 case LDKCOption_ClosureReasonZ_Some: {
2190 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2191 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2193 case LDKCOption_ClosureReasonZ_None: {
2194 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2199 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2200 CHECK(owner->result_ok);
2201 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2204 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2205 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2206 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2207 int64_t ret_ref = (uintptr_t)ret_copy;
2211 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2212 CHECK(!owner->result_ok);
2213 return DecodeError_clone(&*owner->contents.err);
2215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2216 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2217 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2218 int64_t ret_ref = 0;
2219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2222 ret_ref = (uintptr_t)ret_var.inner;
2223 if (ret_var.is_owned) {
2229 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2230 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2231 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
2232 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
2233 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2234 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2236 LDKNetworkUpdate_ChannelUpdateMessage_class =
2237 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2238 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2239 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2240 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2241 LDKNetworkUpdate_ChannelClosed_class =
2242 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed"));
2243 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
2244 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
2245 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
2246 LDKNetworkUpdate_NodeFailure_class =
2247 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2248 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2249 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2250 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2252 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2253 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2255 case LDKNetworkUpdate_ChannelUpdateMessage: {
2256 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2257 int64_t msg_ref = 0;
2258 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2259 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2260 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2261 msg_ref = (uintptr_t)msg_var.inner & ~1;
2262 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2264 case LDKNetworkUpdate_ChannelClosed: {
2265 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
2267 case LDKNetworkUpdate_NodeFailure: {
2268 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2269 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2270 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
2275 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2276 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2277 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2278 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2280 LDKCOption_NetworkUpdateZ_Some_class =
2281 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2282 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2283 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2284 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2285 LDKCOption_NetworkUpdateZ_None_class =
2286 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2287 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2288 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2289 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2291 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2292 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2294 case LDKCOption_NetworkUpdateZ_Some: {
2295 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2296 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2298 case LDKCOption_NetworkUpdateZ_None: {
2299 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2304 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2305 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2306 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2307 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2308 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2309 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2311 LDKSpendableOutputDescriptor_StaticOutput_class =
2312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2313 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2314 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2315 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2316 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2317 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2318 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2319 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2320 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2321 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2322 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2323 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2324 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2325 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2327 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2328 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2330 case LDKSpendableOutputDescriptor_StaticOutput: {
2331 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2332 int64_t outpoint_ref = 0;
2333 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2334 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2335 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2336 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2337 int64_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2338 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (int64_t)output_ref);
2340 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2341 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2342 int64_t delayed_payment_output_ref = 0;
2343 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2344 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2345 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2346 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2347 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2349 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2350 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2351 int64_t static_payment_output_ref = 0;
2352 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2353 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2354 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2355 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2356 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2361 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2362 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2363 for (size_t i = 0; i < ret.datalen; i++) {
2364 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2368 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
2369 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
2370 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
2371 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
2372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
2373 LDKPaymentPurpose_InvoicePayment_class =
2374 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
2375 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
2376 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
2377 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
2378 LDKPaymentPurpose_SpontaneousPayment_class =
2379 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
2380 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
2381 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
2382 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
2384 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2385 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
2387 case LDKPaymentPurpose_InvoicePayment: {
2388 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2389 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
2390 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
2391 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
2392 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
2394 case LDKPaymentPurpose_SpontaneousPayment: {
2395 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
2396 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
2397 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
2402 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2403 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2404 static jclass LDKEvent_PaymentReceived_class = NULL;
2405 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2406 static jclass LDKEvent_PaymentSent_class = NULL;
2407 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2408 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2409 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2410 static jclass LDKEvent_PaymentFailed_class = NULL;
2411 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2412 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2413 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2414 static jclass LDKEvent_SpendableOutputs_class = NULL;
2415 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2416 static jclass LDKEvent_PaymentForwarded_class = NULL;
2417 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2418 static jclass LDKEvent_ChannelClosed_class = NULL;
2419 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2420 static jclass LDKEvent_DiscardFunding_class = NULL;
2421 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2422 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2423 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2424 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2425 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2427 LDKEvent_FundingGenerationReady_class =
2428 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2429 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2430 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
2431 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2432 LDKEvent_PaymentReceived_class =
2433 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2434 CHECK(LDKEvent_PaymentReceived_class != NULL);
2435 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2436 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2437 LDKEvent_PaymentSent_class =
2438 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2439 CHECK(LDKEvent_PaymentSent_class != NULL);
2440 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2441 CHECK(LDKEvent_PaymentSent_meth != NULL);
2442 LDKEvent_PaymentPathFailed_class =
2443 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2444 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2445 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2446 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2447 LDKEvent_PaymentFailed_class =
2448 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2449 CHECK(LDKEvent_PaymentFailed_class != NULL);
2450 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2451 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2452 LDKEvent_PendingHTLCsForwardable_class =
2453 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2454 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2455 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2456 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2457 LDKEvent_SpendableOutputs_class =
2458 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2459 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2460 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2461 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2462 LDKEvent_PaymentForwarded_class =
2463 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2464 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2465 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
2466 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2467 LDKEvent_ChannelClosed_class =
2468 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2469 CHECK(LDKEvent_ChannelClosed_class != NULL);
2470 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2471 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2472 LDKEvent_DiscardFunding_class =
2473 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2474 CHECK(LDKEvent_DiscardFunding_class != NULL);
2475 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2476 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2477 LDKEvent_PaymentPathSuccessful_class =
2478 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2479 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2480 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2481 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2482 LDKEvent_OpenChannelRequest_class =
2483 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2484 CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2485 LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2486 CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2488 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2489 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2491 case LDKEvent_FundingGenerationReady: {
2492 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2493 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2494 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2495 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2496 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2497 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);
2499 case LDKEvent_PaymentReceived: {
2500 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2501 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2502 int64_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2503 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
2505 case LDKEvent_PaymentSent: {
2506 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2507 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2508 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2509 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2510 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2511 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2512 int64_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2513 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2515 case LDKEvent_PaymentPathFailed: {
2516 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2517 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2518 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2519 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2520 int64_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2521 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2522 int64_tArray path_arr = NULL;
2523 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2524 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2525 for (size_t k = 0; k < path_var.datalen; k++) {
2526 LDKRouteHop path_conv_10_var = path_var.data[k];
2527 int64_t path_conv_10_ref = 0;
2528 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2529 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2530 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2531 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2532 path_arr_ptr[k] = path_conv_10_ref;
2534 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2535 int64_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2536 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2537 int64_t retry_ref = 0;
2538 if ((uintptr_t)retry_var.inner > 4096) {
2539 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2540 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2541 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2542 retry_ref = (uintptr_t)retry_var.inner & ~1;
2544 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);
2546 case LDKEvent_PaymentFailed: {
2547 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2548 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2549 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2550 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2551 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2553 case LDKEvent_PendingHTLCsForwardable: {
2554 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
2556 case LDKEvent_SpendableOutputs: {
2557 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2558 int64_tArray outputs_arr = NULL;
2559 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2560 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2561 for (size_t b = 0; b < outputs_var.datalen; b++) {
2562 int64_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2563 outputs_arr_ptr[b] = outputs_conv_27_ref;
2565 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2566 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2568 case LDKEvent_PaymentForwarded: {
2569 int64_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2570 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
2572 case LDKEvent_ChannelClosed: {
2573 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2574 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2575 int64_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2576 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
2578 case LDKEvent_DiscardFunding: {
2579 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2580 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2581 LDKTransaction transaction_var = obj->discard_funding.transaction;
2582 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2583 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2584 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2586 case LDKEvent_PaymentPathSuccessful: {
2587 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2588 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2589 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2590 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2591 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2592 int64_tArray path_arr = NULL;
2593 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2594 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2595 for (size_t k = 0; k < path_var.datalen; k++) {
2596 LDKRouteHop path_conv_10_var = path_var.data[k];
2597 int64_t path_conv_10_ref = 0;
2598 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2599 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2600 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2601 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2602 path_arr_ptr[k] = path_conv_10_ref;
2604 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2605 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2607 case LDKEvent_OpenChannelRequest: {
2608 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2609 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2610 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2611 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2612 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2613 int64_t channel_type_ref = 0;
2614 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2615 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2616 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2617 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
2618 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, channel_type_ref);
2623 static jclass LDKCOption_EventZ_Some_class = NULL;
2624 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2625 static jclass LDKCOption_EventZ_None_class = NULL;
2626 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2628 LDKCOption_EventZ_Some_class =
2629 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2630 CHECK(LDKCOption_EventZ_Some_class != NULL);
2631 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2632 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2633 LDKCOption_EventZ_None_class =
2634 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2635 CHECK(LDKCOption_EventZ_None_class != NULL);
2636 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2637 CHECK(LDKCOption_EventZ_None_meth != NULL);
2639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2640 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2642 case LDKCOption_EventZ_Some: {
2643 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2644 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2646 case LDKCOption_EventZ_None: {
2647 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2652 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2653 CHECK(owner->result_ok);
2654 return COption_EventZ_clone(&*owner->contents.result);
2656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2657 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2658 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2659 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2660 int64_t ret_ref = (uintptr_t)ret_copy;
2664 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2665 CHECK(!owner->result_ok);
2666 return DecodeError_clone(&*owner->contents.err);
2668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2669 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2670 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2671 int64_t ret_ref = 0;
2672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2675 ret_ref = (uintptr_t)ret_var.inner;
2676 if (ret_var.is_owned) {
2682 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2683 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2684 static jclass LDKErrorAction_IgnoreError_class = NULL;
2685 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2686 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2687 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2688 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2689 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2690 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2691 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2692 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2693 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2695 LDKErrorAction_DisconnectPeer_class =
2696 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2697 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2698 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2699 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2700 LDKErrorAction_IgnoreError_class =
2701 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2702 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2703 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2704 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2705 LDKErrorAction_IgnoreAndLog_class =
2706 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2707 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2708 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2709 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2710 LDKErrorAction_IgnoreDuplicateGossip_class =
2711 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2712 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2713 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2714 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2715 LDKErrorAction_SendErrorMessage_class =
2716 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2717 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2718 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2719 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2720 LDKErrorAction_SendWarningMessage_class =
2721 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2722 CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2723 LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2724 CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2726 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2727 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2729 case LDKErrorAction_DisconnectPeer: {
2730 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2731 int64_t msg_ref = 0;
2732 if ((uintptr_t)msg_var.inner > 4096) {
2733 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2734 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2735 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2736 msg_ref = (uintptr_t)msg_var.inner & ~1;
2738 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2740 case LDKErrorAction_IgnoreError: {
2741 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2743 case LDKErrorAction_IgnoreAndLog: {
2744 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2745 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2747 case LDKErrorAction_IgnoreDuplicateGossip: {
2748 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2750 case LDKErrorAction_SendErrorMessage: {
2751 LDKErrorMessage msg_var = obj->send_error_message.msg;
2752 int64_t msg_ref = 0;
2753 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2754 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2755 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2756 msg_ref = (uintptr_t)msg_var.inner & ~1;
2757 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2759 case LDKErrorAction_SendWarningMessage: {
2760 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2761 int64_t msg_ref = 0;
2762 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2763 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2764 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2765 msg_ref = (uintptr_t)msg_var.inner & ~1;
2766 jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2767 return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2772 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2773 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2774 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2775 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2776 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2777 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2778 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2779 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2780 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
2781 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
2782 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2783 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2784 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2785 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2786 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2787 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2788 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2789 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2790 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2791 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2792 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2793 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2794 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2795 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2796 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2797 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2798 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2799 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2800 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2801 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2802 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2803 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2804 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2805 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2806 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2807 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2808 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2809 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2810 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2811 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2813 LDKMessageSendEvent_SendAcceptChannel_class =
2814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2815 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2816 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2817 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2818 LDKMessageSendEvent_SendOpenChannel_class =
2819 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2820 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2821 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2822 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2823 LDKMessageSendEvent_SendFundingCreated_class =
2824 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2825 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2826 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2827 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2828 LDKMessageSendEvent_SendFundingSigned_class =
2829 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2830 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2831 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2832 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2833 LDKMessageSendEvent_SendFundingLocked_class =
2834 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked"));
2835 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
2836 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
2837 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
2838 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2840 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2841 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2842 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2843 LDKMessageSendEvent_UpdateHTLCs_class =
2844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2845 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2846 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2847 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2848 LDKMessageSendEvent_SendRevokeAndACK_class =
2849 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2850 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2851 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2852 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2853 LDKMessageSendEvent_SendClosingSigned_class =
2854 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2855 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2856 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2857 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2858 LDKMessageSendEvent_SendShutdown_class =
2859 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2860 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2861 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2862 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2863 LDKMessageSendEvent_SendChannelReestablish_class =
2864 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2865 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2866 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2867 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2868 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2869 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2870 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2871 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2872 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2873 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2874 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2875 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2876 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2877 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2878 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2879 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2880 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2881 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2882 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2883 LDKMessageSendEvent_SendChannelUpdate_class =
2884 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2885 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2886 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2887 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2888 LDKMessageSendEvent_HandleError_class =
2889 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2890 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2891 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2892 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2893 LDKMessageSendEvent_SendChannelRangeQuery_class =
2894 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2895 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2896 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2897 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2898 LDKMessageSendEvent_SendShortIdsQuery_class =
2899 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2900 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2901 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2902 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2903 LDKMessageSendEvent_SendReplyChannelRange_class =
2904 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2905 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2906 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2907 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2908 LDKMessageSendEvent_SendGossipTimestampFilter_class =
2909 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2910 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2911 LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2912 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2914 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2915 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2917 case LDKMessageSendEvent_SendAcceptChannel: {
2918 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2919 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2920 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2921 int64_t msg_ref = 0;
2922 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2923 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2924 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2925 msg_ref = (uintptr_t)msg_var.inner & ~1;
2926 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2928 case LDKMessageSendEvent_SendOpenChannel: {
2929 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2930 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2931 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2932 int64_t msg_ref = 0;
2933 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2934 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2935 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2936 msg_ref = (uintptr_t)msg_var.inner & ~1;
2937 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2939 case LDKMessageSendEvent_SendFundingCreated: {
2940 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2941 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2942 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2943 int64_t msg_ref = 0;
2944 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2945 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2946 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2947 msg_ref = (uintptr_t)msg_var.inner & ~1;
2948 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2950 case LDKMessageSendEvent_SendFundingSigned: {
2951 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2952 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2953 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2954 int64_t msg_ref = 0;
2955 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2956 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2957 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2958 msg_ref = (uintptr_t)msg_var.inner & ~1;
2959 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2961 case LDKMessageSendEvent_SendFundingLocked: {
2962 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2963 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
2964 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2965 int64_t msg_ref = 0;
2966 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2967 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2968 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2969 msg_ref = (uintptr_t)msg_var.inner & ~1;
2970 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
2972 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2973 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2974 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2975 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2976 int64_t msg_ref = 0;
2977 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2978 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2979 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2980 msg_ref = (uintptr_t)msg_var.inner & ~1;
2981 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2983 case LDKMessageSendEvent_UpdateHTLCs: {
2984 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2985 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2986 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2987 int64_t updates_ref = 0;
2988 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2989 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2990 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2991 updates_ref = (uintptr_t)updates_var.inner & ~1;
2992 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2994 case LDKMessageSendEvent_SendRevokeAndACK: {
2995 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2996 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2997 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2998 int64_t msg_ref = 0;
2999 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3000 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3001 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3002 msg_ref = (uintptr_t)msg_var.inner & ~1;
3003 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
3005 case LDKMessageSendEvent_SendClosingSigned: {
3006 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3007 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
3008 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3009 int64_t msg_ref = 0;
3010 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3011 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3012 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3013 msg_ref = (uintptr_t)msg_var.inner & ~1;
3014 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
3016 case LDKMessageSendEvent_SendShutdown: {
3017 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3018 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
3019 LDKShutdown msg_var = obj->send_shutdown.msg;
3020 int64_t msg_ref = 0;
3021 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3022 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3023 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3024 msg_ref = (uintptr_t)msg_var.inner & ~1;
3025 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
3027 case LDKMessageSendEvent_SendChannelReestablish: {
3028 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3029 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
3030 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3031 int64_t msg_ref = 0;
3032 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3033 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3034 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3035 msg_ref = (uintptr_t)msg_var.inner & ~1;
3036 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
3038 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
3039 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3040 int64_t msg_ref = 0;
3041 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3042 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3043 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3044 msg_ref = (uintptr_t)msg_var.inner & ~1;
3045 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3046 int64_t update_msg_ref = 0;
3047 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3048 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3049 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3050 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
3051 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
3053 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
3054 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3055 int64_t msg_ref = 0;
3056 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3057 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3058 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3059 msg_ref = (uintptr_t)msg_var.inner & ~1;
3060 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
3062 case LDKMessageSendEvent_BroadcastChannelUpdate: {
3063 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3064 int64_t msg_ref = 0;
3065 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3066 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3067 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3068 msg_ref = (uintptr_t)msg_var.inner & ~1;
3069 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
3071 case LDKMessageSendEvent_SendChannelUpdate: {
3072 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3073 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
3074 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3075 int64_t msg_ref = 0;
3076 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3077 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3078 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3079 msg_ref = (uintptr_t)msg_var.inner & ~1;
3080 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
3082 case LDKMessageSendEvent_HandleError: {
3083 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3084 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
3085 int64_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
3086 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
3088 case LDKMessageSendEvent_SendChannelRangeQuery: {
3089 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3090 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
3091 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3092 int64_t msg_ref = 0;
3093 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3094 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3095 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3096 msg_ref = (uintptr_t)msg_var.inner & ~1;
3097 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3099 case LDKMessageSendEvent_SendShortIdsQuery: {
3100 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3101 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3102 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3103 int64_t msg_ref = 0;
3104 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3105 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3106 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3107 msg_ref = (uintptr_t)msg_var.inner & ~1;
3108 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3110 case LDKMessageSendEvent_SendReplyChannelRange: {
3111 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3112 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3113 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3114 int64_t msg_ref = 0;
3115 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3116 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3117 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3118 msg_ref = (uintptr_t)msg_var.inner & ~1;
3119 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3121 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3122 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3123 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3124 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3125 int64_t msg_ref = 0;
3126 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3127 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3128 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3129 msg_ref = (uintptr_t)msg_var.inner & ~1;
3130 return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3135 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3136 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3137 for (size_t i = 0; i < ret.datalen; i++) {
3138 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3142 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3143 CHECK(owner->result_ok);
3144 return FixedPenaltyScorer_clone(&*owner->contents.result);
3146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3147 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3148 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3149 int64_t ret_ref = 0;
3150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3153 ret_ref = (uintptr_t)ret_var.inner;
3154 if (ret_var.is_owned) {
3160 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3161 CHECK(!owner->result_ok);
3162 return DecodeError_clone(&*owner->contents.err);
3164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3165 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3166 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3167 int64_t ret_ref = 0;
3168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3171 ret_ref = (uintptr_t)ret_var.inner;
3172 if (ret_var.is_owned) {
3178 static inline struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3179 CHECK(owner->result_ok);
3180 return ScoringParameters_clone(&*owner->contents.result);
3182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3183 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3184 LDKScoringParameters ret_var = CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
3185 int64_t ret_ref = 0;
3186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3189 ret_ref = (uintptr_t)ret_var.inner;
3190 if (ret_var.is_owned) {
3196 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3197 CHECK(!owner->result_ok);
3198 return DecodeError_clone(&*owner->contents.err);
3200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3201 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3202 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
3203 int64_t ret_ref = 0;
3204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3207 ret_ref = (uintptr_t)ret_var.inner;
3208 if (ret_var.is_owned) {
3214 static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3215 CHECK(owner->result_ok);
3216 return &*owner->contents.result;
3218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3219 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3220 LDKScorer ret_var = *CResult_ScorerDecodeErrorZ_get_ok(owner_conv);
3221 int64_t ret_ref = 0;
3222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3225 ret_ref = (uintptr_t)ret_var.inner & ~1;
3229 static inline struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3230 CHECK(!owner->result_ok);
3231 return DecodeError_clone(&*owner->contents.err);
3233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3234 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3235 LDKDecodeError ret_var = CResult_ScorerDecodeErrorZ_get_err(owner_conv);
3236 int64_t ret_ref = 0;
3237 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3238 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3240 ret_ref = (uintptr_t)ret_var.inner;
3241 if (ret_var.is_owned) {
3247 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3248 CHECK(owner->result_ok);
3249 return &*owner->contents.result;
3251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3252 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3253 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3254 int64_t ret_ref = 0;
3255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3258 ret_ref = (uintptr_t)ret_var.inner & ~1;
3262 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3263 CHECK(!owner->result_ok);
3264 return DecodeError_clone(&*owner->contents.err);
3266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3267 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3268 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3269 int64_t ret_ref = 0;
3270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3273 ret_ref = (uintptr_t)ret_var.inner;
3274 if (ret_var.is_owned) {
3280 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3281 CHECK(owner->result_ok);
3282 return InitFeatures_clone(&*owner->contents.result);
3284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3285 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3286 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3287 int64_t ret_ref = 0;
3288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3291 ret_ref = (uintptr_t)ret_var.inner;
3292 if (ret_var.is_owned) {
3298 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3299 CHECK(!owner->result_ok);
3300 return DecodeError_clone(&*owner->contents.err);
3302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3303 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3304 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3305 int64_t ret_ref = 0;
3306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3309 ret_ref = (uintptr_t)ret_var.inner;
3310 if (ret_var.is_owned) {
3316 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3317 CHECK(owner->result_ok);
3318 return ChannelFeatures_clone(&*owner->contents.result);
3320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3321 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3322 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3323 int64_t ret_ref = 0;
3324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3327 ret_ref = (uintptr_t)ret_var.inner;
3328 if (ret_var.is_owned) {
3334 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3335 CHECK(!owner->result_ok);
3336 return DecodeError_clone(&*owner->contents.err);
3338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3339 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3340 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3341 int64_t ret_ref = 0;
3342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3345 ret_ref = (uintptr_t)ret_var.inner;
3346 if (ret_var.is_owned) {
3352 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3353 CHECK(owner->result_ok);
3354 return NodeFeatures_clone(&*owner->contents.result);
3356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3357 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3358 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3359 int64_t ret_ref = 0;
3360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3363 ret_ref = (uintptr_t)ret_var.inner;
3364 if (ret_var.is_owned) {
3370 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3371 CHECK(!owner->result_ok);
3372 return DecodeError_clone(&*owner->contents.err);
3374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3375 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3376 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3377 int64_t ret_ref = 0;
3378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3381 ret_ref = (uintptr_t)ret_var.inner;
3382 if (ret_var.is_owned) {
3388 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3389 CHECK(owner->result_ok);
3390 return InvoiceFeatures_clone(&*owner->contents.result);
3392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3393 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3394 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3395 int64_t ret_ref = 0;
3396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3399 ret_ref = (uintptr_t)ret_var.inner;
3400 if (ret_var.is_owned) {
3406 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3407 CHECK(!owner->result_ok);
3408 return DecodeError_clone(&*owner->contents.err);
3410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3411 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3412 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3413 int64_t ret_ref = 0;
3414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3417 ret_ref = (uintptr_t)ret_var.inner;
3418 if (ret_var.is_owned) {
3424 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3425 CHECK(owner->result_ok);
3426 return ChannelTypeFeatures_clone(&*owner->contents.result);
3428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3429 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3430 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3431 int64_t ret_ref = 0;
3432 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3433 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3435 ret_ref = (uintptr_t)ret_var.inner;
3436 if (ret_var.is_owned) {
3442 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3443 CHECK(!owner->result_ok);
3444 return DecodeError_clone(&*owner->contents.err);
3446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3447 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3448 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3449 int64_t ret_ref = 0;
3450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3453 ret_ref = (uintptr_t)ret_var.inner;
3454 if (ret_var.is_owned) {
3460 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3461 CHECK(owner->result_ok);
3462 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3465 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3466 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3467 int64_t ret_ref = 0;
3468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3471 ret_ref = (uintptr_t)ret_var.inner;
3472 if (ret_var.is_owned) {
3478 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3479 CHECK(!owner->result_ok);
3480 return DecodeError_clone(&*owner->contents.err);
3482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3483 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3484 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3485 int64_t ret_ref = 0;
3486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3489 ret_ref = (uintptr_t)ret_var.inner;
3490 if (ret_var.is_owned) {
3496 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3497 CHECK(owner->result_ok);
3498 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3501 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3502 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3503 int64_t ret_ref = 0;
3504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3507 ret_ref = (uintptr_t)ret_var.inner;
3508 if (ret_var.is_owned) {
3514 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3515 CHECK(!owner->result_ok);
3516 return DecodeError_clone(&*owner->contents.err);
3518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3519 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3520 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3521 int64_t ret_ref = 0;
3522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3525 ret_ref = (uintptr_t)ret_var.inner;
3526 if (ret_var.is_owned) {
3532 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3533 CHECK(owner->result_ok);
3534 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3537 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3538 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3539 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3540 int64_t ret_ref = (uintptr_t)ret_copy;
3544 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3545 CHECK(!owner->result_ok);
3546 return DecodeError_clone(&*owner->contents.err);
3548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3549 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3550 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3551 int64_t ret_ref = 0;
3552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3555 ret_ref = (uintptr_t)ret_var.inner;
3556 if (ret_var.is_owned) {
3562 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3563 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3564 for (size_t i = 0; i < ret.datalen; i++) {
3565 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3569 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3573 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3574 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3575 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
3579 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3582 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3583 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3584 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3585 jobjectArray ret_arr = NULL;
3586 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3588 for (size_t i = 0; i < ret_var.datalen; i++) {
3589 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
3590 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
3591 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3597 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3598 CHECK(owner->result_ok);
3599 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3602 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3603 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3604 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3605 return ((int64_t)ret_conv);
3608 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3609 CHECK(!owner->result_ok);
3610 return *owner->contents.err;
3612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3613 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3614 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3617 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3618 CHECK(owner->result_ok);
3619 return *owner->contents.result;
3621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3622 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3623 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3624 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
3628 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3629 CHECK(!owner->result_ok);
3630 return *owner->contents.err;
3632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3633 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3634 CResult_SignatureNoneZ_get_err(owner_conv);
3637 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3641 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3642 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3643 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
3647 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3651 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3652 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3653 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
3657 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3658 CHECK(owner->result_ok);
3659 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3662 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3663 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3664 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3665 return ((int64_t)ret_conv);
3668 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3669 CHECK(!owner->result_ok);
3670 return *owner->contents.err;
3672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3673 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3674 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3677 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3678 CHECK(owner->result_ok);
3679 return *owner->contents.result;
3681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3682 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3683 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3684 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
3688 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3689 CHECK(!owner->result_ok);
3690 return *owner->contents.err;
3692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3693 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3694 CResult_SecretKeyNoneZ_get_err(owner_conv);
3697 typedef struct LDKBaseSign_JCalls {
3698 atomic_size_t refcnt;
3701 jmethodID get_per_commitment_point_meth;
3702 jmethodID release_commitment_secret_meth;
3703 jmethodID validate_holder_commitment_meth;
3704 jmethodID channel_keys_id_meth;
3705 jmethodID sign_counterparty_commitment_meth;
3706 jmethodID validate_counterparty_revocation_meth;
3707 jmethodID sign_holder_commitment_and_htlcs_meth;
3708 jmethodID sign_justice_revoked_output_meth;
3709 jmethodID sign_justice_revoked_htlc_meth;
3710 jmethodID sign_counterparty_htlc_transaction_meth;
3711 jmethodID sign_closing_transaction_meth;
3712 jmethodID sign_channel_announcement_meth;
3713 jmethodID ready_channel_meth;
3714 } LDKBaseSign_JCalls;
3715 static void LDKBaseSign_JCalls_free(void* this_arg) {
3716 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3717 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3719 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3720 if (get_jenv_res == JNI_EDETACHED) {
3721 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3723 DO_ASSERT(get_jenv_res == JNI_OK);
3725 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3726 if (get_jenv_res == JNI_EDETACHED) {
3727 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3732 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3733 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3735 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3736 if (get_jenv_res == JNI_EDETACHED) {
3737 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3739 DO_ASSERT(get_jenv_res == JNI_OK);
3741 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3743 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
3744 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3745 (*env)->ExceptionDescribe(env);
3746 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
3748 LDKPublicKey ret_ref;
3749 CHECK((*env)->GetArrayLength(env, ret) == 33);
3750 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3751 if (get_jenv_res == JNI_EDETACHED) {
3752 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3756 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3757 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3759 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3760 if (get_jenv_res == JNI_EDETACHED) {
3761 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3763 DO_ASSERT(get_jenv_res == JNI_OK);
3765 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3767 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
3768 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3769 (*env)->ExceptionDescribe(env);
3770 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
3772 LDKThirtyTwoBytes ret_ref;
3773 CHECK((*env)->GetArrayLength(env, ret) == 32);
3774 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3775 if (get_jenv_res == JNI_EDETACHED) {
3776 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3780 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3781 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3783 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3784 if (get_jenv_res == JNI_EDETACHED) {
3785 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3787 DO_ASSERT(get_jenv_res == JNI_OK);
3789 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3790 int64_t holder_tx_ref = 0;
3791 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3792 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3793 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3794 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3795 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3796 if (holder_tx_var.is_owned) {
3799 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3800 jobjectArray preimages_arr = NULL;
3801 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3803 for (size_t i = 0; i < preimages_var.datalen; i++) {
3804 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3805 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3806 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3809 FREE(preimages_var.data);
3810 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3812 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
3813 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3814 (*env)->ExceptionDescribe(env);
3815 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
3817 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3818 CHECK_ACCESS(ret_ptr);
3819 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3821 if (get_jenv_res == JNI_EDETACHED) {
3822 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3826 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3827 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3829 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3830 if (get_jenv_res == JNI_EDETACHED) {
3831 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3833 DO_ASSERT(get_jenv_res == JNI_OK);
3835 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3837 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3838 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3839 (*env)->ExceptionDescribe(env);
3840 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
3842 LDKThirtyTwoBytes ret_ref;
3843 CHECK((*env)->GetArrayLength(env, ret) == 32);
3844 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3845 if (get_jenv_res == JNI_EDETACHED) {
3846 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3850 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3851 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3853 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3854 if (get_jenv_res == JNI_EDETACHED) {
3855 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3857 DO_ASSERT(get_jenv_res == JNI_OK);
3859 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3860 int64_t commitment_tx_ref = 0;
3861 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3862 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3863 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3864 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3865 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3866 if (commitment_tx_var.is_owned) {
3867 commitment_tx_ref |= 1;
3869 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3870 jobjectArray preimages_arr = NULL;
3871 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3873 for (size_t i = 0; i < preimages_var.datalen; i++) {
3874 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3875 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3876 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3879 FREE(preimages_var.data);
3880 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3882 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
3883 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3884 (*env)->ExceptionDescribe(env);
3885 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
3887 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3888 CHECK_ACCESS(ret_ptr);
3889 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3891 if (get_jenv_res == JNI_EDETACHED) {
3892 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3896 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3897 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3899 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3900 if (get_jenv_res == JNI_EDETACHED) {
3901 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3903 DO_ASSERT(get_jenv_res == JNI_OK);
3905 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3906 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3907 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3909 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
3910 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3911 (*env)->ExceptionDescribe(env);
3912 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
3914 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3915 CHECK_ACCESS(ret_ptr);
3916 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3918 if (get_jenv_res == JNI_EDETACHED) {
3919 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3923 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3924 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3926 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3927 if (get_jenv_res == JNI_EDETACHED) {
3928 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3930 DO_ASSERT(get_jenv_res == JNI_OK);
3932 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3933 int64_t commitment_tx_ref = 0;
3934 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3935 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3936 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3937 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3938 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3939 if (commitment_tx_var.is_owned) {
3940 commitment_tx_ref |= 1;
3942 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3944 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
3945 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3946 (*env)->ExceptionDescribe(env);
3947 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
3949 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3950 CHECK_ACCESS(ret_ptr);
3951 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3953 if (get_jenv_res == JNI_EDETACHED) {
3954 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3958 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]) {
3959 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3961 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3962 if (get_jenv_res == JNI_EDETACHED) {
3963 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3965 DO_ASSERT(get_jenv_res == JNI_OK);
3967 LDKTransaction justice_tx_var = justice_tx;
3968 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3969 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3970 Transaction_free(justice_tx_var);
3971 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3972 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3973 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3975 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
3976 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3977 (*env)->ExceptionDescribe(env);
3978 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
3980 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3981 CHECK_ACCESS(ret_ptr);
3982 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3984 if (get_jenv_res == JNI_EDETACHED) {
3985 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3989 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) {
3990 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3992 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3993 if (get_jenv_res == JNI_EDETACHED) {
3994 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3996 DO_ASSERT(get_jenv_res == JNI_OK);
3998 LDKTransaction justice_tx_var = justice_tx;
3999 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4000 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4001 Transaction_free(justice_tx_var);
4002 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4003 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4004 LDKHTLCOutputInCommitment htlc_var = *htlc;
4005 int64_t htlc_ref = 0;
4006 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4007 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4008 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4009 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4010 htlc_ref = (uintptr_t)htlc_var.inner;
4011 if (htlc_var.is_owned) {
4014 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4016 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);
4017 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4018 (*env)->ExceptionDescribe(env);
4019 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
4021 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4022 CHECK_ACCESS(ret_ptr);
4023 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4025 if (get_jenv_res == JNI_EDETACHED) {
4026 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4030 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) {
4031 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4033 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4034 if (get_jenv_res == JNI_EDETACHED) {
4035 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4037 DO_ASSERT(get_jenv_res == JNI_OK);
4039 LDKTransaction htlc_tx_var = htlc_tx;
4040 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4041 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4042 Transaction_free(htlc_tx_var);
4043 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4044 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4045 LDKHTLCOutputInCommitment htlc_var = *htlc;
4046 int64_t htlc_ref = 0;
4047 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4048 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4049 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4050 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4051 htlc_ref = (uintptr_t)htlc_var.inner;
4052 if (htlc_var.is_owned) {
4055 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4057 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);
4058 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4059 (*env)->ExceptionDescribe(env);
4060 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4062 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4063 CHECK_ACCESS(ret_ptr);
4064 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4066 if (get_jenv_res == JNI_EDETACHED) {
4067 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4071 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4072 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4074 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4075 if (get_jenv_res == JNI_EDETACHED) {
4076 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4078 DO_ASSERT(get_jenv_res == JNI_OK);
4080 LDKClosingTransaction closing_tx_var = *closing_tx;
4081 int64_t closing_tx_ref = 0;
4082 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4083 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4084 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4085 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4086 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
4087 if (closing_tx_var.is_owned) {
4088 closing_tx_ref |= 1;
4090 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4092 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4093 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4094 (*env)->ExceptionDescribe(env);
4095 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4097 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4098 CHECK_ACCESS(ret_ptr);
4099 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4101 if (get_jenv_res == JNI_EDETACHED) {
4102 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4106 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4107 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4109 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4110 if (get_jenv_res == JNI_EDETACHED) {
4111 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4113 DO_ASSERT(get_jenv_res == JNI_OK);
4115 LDKUnsignedChannelAnnouncement msg_var = *msg;
4116 int64_t msg_ref = 0;
4117 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4118 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4119 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4120 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4121 msg_ref = (uintptr_t)msg_var.inner;
4122 if (msg_var.is_owned) {
4125 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4127 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4128 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4129 (*env)->ExceptionDescribe(env);
4130 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4132 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4133 CHECK_ACCESS(ret_ptr);
4134 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4136 if (get_jenv_res == JNI_EDETACHED) {
4137 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4141 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4142 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4144 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4145 if (get_jenv_res == JNI_EDETACHED) {
4146 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4148 DO_ASSERT(get_jenv_res == JNI_OK);
4150 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4151 int64_t channel_parameters_ref = 0;
4152 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4153 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4154 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4155 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4156 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
4157 if (channel_parameters_var.is_owned) {
4158 channel_parameters_ref |= 1;
4160 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4162 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4163 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4164 (*env)->ExceptionDescribe(env);
4165 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4167 if (get_jenv_res == JNI_EDETACHED) {
4168 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4171 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4172 jclass c = (*env)->GetObjectClass(env, o);
4174 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4175 atomic_init(&calls->refcnt, 1);
4176 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4177 calls->o = (*env)->NewWeakGlobalRef(env, o);
4178 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4179 CHECK(calls->get_per_commitment_point_meth != NULL);
4180 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4181 CHECK(calls->release_commitment_secret_meth != NULL);
4182 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4183 CHECK(calls->validate_holder_commitment_meth != NULL);
4184 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4185 CHECK(calls->channel_keys_id_meth != NULL);
4186 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4187 CHECK(calls->sign_counterparty_commitment_meth != NULL);
4188 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4189 CHECK(calls->validate_counterparty_revocation_meth != NULL);
4190 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4191 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4192 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4193 CHECK(calls->sign_justice_revoked_output_meth != NULL);
4194 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4195 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4196 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4197 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4198 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4199 CHECK(calls->sign_closing_transaction_meth != NULL);
4200 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4201 CHECK(calls->sign_channel_announcement_meth != NULL);
4202 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4203 CHECK(calls->ready_channel_meth != NULL);
4205 LDKChannelPublicKeys pubkeys_conv;
4206 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4207 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4208 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4211 .this_arg = (void*) calls,
4212 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4213 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4214 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4215 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4216 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4217 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4218 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4219 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4220 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4221 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4222 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4223 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4224 .ready_channel = ready_channel_LDKBaseSign_jcall,
4225 .free = LDKBaseSign_JCalls_free,
4226 .pubkeys = pubkeys_conv,
4227 .set_pubkeys = NULL,
4231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4232 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4233 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
4234 return (uint64_t)res_ptr;
4236 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) {
4237 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4238 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4239 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4240 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4241 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
4245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4246 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4247 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4248 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4249 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4250 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
4254 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) {
4255 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4256 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4257 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4258 LDKHolderCommitmentTransaction holder_tx_conv;
4259 holder_tx_conv.inner = (void*)(holder_tx & (~1));
4260 holder_tx_conv.is_owned = false;
4261 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4262 LDKCVec_PaymentPreimageZ preimages_constr;
4263 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4264 if (preimages_constr.datalen > 0)
4265 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4267 preimages_constr.data = NULL;
4268 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4269 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4270 LDKThirtyTwoBytes preimages_conv_8_ref;
4271 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4272 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4273 preimages_constr.data[i] = preimages_conv_8_ref;
4275 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4276 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4277 return (int64_t)ret_conv;
4280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4281 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4282 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4283 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4284 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4285 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
4289 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) {
4290 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4291 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4292 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4293 LDKCommitmentTransaction commitment_tx_conv;
4294 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4295 commitment_tx_conv.is_owned = false;
4296 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4297 LDKCVec_PaymentPreimageZ preimages_constr;
4298 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4299 if (preimages_constr.datalen > 0)
4300 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4302 preimages_constr.data = NULL;
4303 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4304 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4305 LDKThirtyTwoBytes preimages_conv_8_ref;
4306 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4307 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4308 preimages_constr.data[i] = preimages_conv_8_ref;
4310 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4311 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4312 return (int64_t)ret_conv;
4315 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) {
4316 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4317 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4318 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4319 unsigned char secret_arr[32];
4320 CHECK((*env)->GetArrayLength(env, secret) == 32);
4321 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
4322 unsigned char (*secret_ref)[32] = &secret_arr;
4323 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4324 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4325 return (int64_t)ret_conv;
4328 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) {
4329 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4330 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4331 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4332 LDKHolderCommitmentTransaction commitment_tx_conv;
4333 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4334 commitment_tx_conv.is_owned = false;
4335 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4336 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4337 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4338 return (int64_t)ret_conv;
4341 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) {
4342 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4343 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4344 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4345 LDKTransaction justice_tx_ref;
4346 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4347 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4348 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4349 justice_tx_ref.data_is_owned = true;
4350 unsigned char per_commitment_key_arr[32];
4351 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4352 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4353 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4354 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4355 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4356 return (int64_t)ret_conv;
4359 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) {
4360 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4361 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4362 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4363 LDKTransaction justice_tx_ref;
4364 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4365 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4366 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4367 justice_tx_ref.data_is_owned = true;
4368 unsigned char per_commitment_key_arr[32];
4369 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4370 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4371 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4372 LDKHTLCOutputInCommitment htlc_conv;
4373 htlc_conv.inner = (void*)(htlc & (~1));
4374 htlc_conv.is_owned = false;
4375 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4376 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4377 *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);
4378 return (int64_t)ret_conv;
4381 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) {
4382 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4383 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4384 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4385 LDKTransaction htlc_tx_ref;
4386 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
4387 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4388 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
4389 htlc_tx_ref.data_is_owned = true;
4390 LDKPublicKey per_commitment_point_ref;
4391 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
4392 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
4393 LDKHTLCOutputInCommitment htlc_conv;
4394 htlc_conv.inner = (void*)(htlc & (~1));
4395 htlc_conv.is_owned = false;
4396 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4397 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4398 *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);
4399 return (int64_t)ret_conv;
4402 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) {
4403 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4404 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4405 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4406 LDKClosingTransaction closing_tx_conv;
4407 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4408 closing_tx_conv.is_owned = false;
4409 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4410 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4411 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4412 return (int64_t)ret_conv;
4415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
4416 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4417 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4418 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4419 LDKUnsignedChannelAnnouncement msg_conv;
4420 msg_conv.inner = (void*)(msg & (~1));
4421 msg_conv.is_owned = false;
4422 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4423 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4424 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4425 return (int64_t)ret_conv;
4428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
4429 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4430 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4431 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4432 LDKChannelTransactionParameters channel_parameters_conv;
4433 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4434 channel_parameters_conv.is_owned = false;
4435 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4436 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4439 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4440 if (this_arg->set_pubkeys != NULL)
4441 this_arg->set_pubkeys(this_arg);
4442 return this_arg->pubkeys;
4444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
4445 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4446 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4447 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4448 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4449 int64_t ret_ref = 0;
4450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4453 ret_ref = (uintptr_t)ret_var.inner;
4454 if (ret_var.is_owned) {
4460 typedef struct LDKSign_JCalls {
4461 atomic_size_t refcnt;
4464 LDKBaseSign_JCalls* BaseSign;
4465 jmethodID write_meth;
4467 static void LDKSign_JCalls_free(void* this_arg) {
4468 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4469 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4471 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4472 if (get_jenv_res == JNI_EDETACHED) {
4473 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4475 DO_ASSERT(get_jenv_res == JNI_OK);
4477 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4478 if (get_jenv_res == JNI_EDETACHED) {
4479 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4484 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4485 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4487 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4488 if (get_jenv_res == JNI_EDETACHED) {
4489 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4491 DO_ASSERT(get_jenv_res == JNI_OK);
4493 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4495 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4496 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4497 (*env)->ExceptionDescribe(env);
4498 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
4500 LDKCVec_u8Z ret_ref;
4501 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4502 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4503 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4504 if (get_jenv_res == JNI_EDETACHED) {
4505 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4509 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4510 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4511 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4512 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4514 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4515 jclass c = (*env)->GetObjectClass(env, o);
4517 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4518 atomic_init(&calls->refcnt, 1);
4519 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4520 calls->o = (*env)->NewWeakGlobalRef(env, o);
4521 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4522 CHECK(calls->write_meth != NULL);
4524 LDKChannelPublicKeys pubkeys_conv;
4525 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4526 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4527 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4530 .this_arg = (void*) calls,
4531 .write = write_LDKSign_jcall,
4532 .cloned = LDKSign_JCalls_cloned,
4533 .free = LDKSign_JCalls_free,
4534 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
4536 calls->BaseSign = ret.BaseSign.this_arg;
4539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4540 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4541 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
4542 return (uint64_t)res_ptr;
4544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
4545 LDKSign *inp = (LDKSign *)(arg & ~1);
4546 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
4547 DO_ASSERT((res_ptr & 1) == 0);
4548 return (int64_t)(res_ptr | 1);
4550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4551 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4552 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4553 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4554 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4555 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4556 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4557 CVec_u8Z_free(ret_var);
4561 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4562 CHECK(owner->result_ok);
4563 return Sign_clone(&*owner->contents.result);
4565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4566 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4567 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4568 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4569 return (int64_t)ret_ret;
4572 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4573 CHECK(!owner->result_ok);
4574 return DecodeError_clone(&*owner->contents.err);
4576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4577 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4578 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4579 int64_t ret_ref = 0;
4580 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4581 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4583 ret_ref = (uintptr_t)ret_var.inner;
4584 if (ret_var.is_owned) {
4590 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4591 CHECK(owner->result_ok);
4592 return *owner->contents.result;
4594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4595 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4596 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
4597 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
4601 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4602 CHECK(!owner->result_ok);
4603 return *owner->contents.err;
4605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4606 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4607 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4610 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4611 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4612 for (size_t i = 0; i < ret.datalen; i++) {
4613 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4617 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4618 CHECK(owner->result_ok);
4619 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4621 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4622 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4623 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4624 jobjectArray ret_arr = NULL;
4625 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4627 for (size_t i = 0; i < ret_var.datalen; i++) {
4628 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
4629 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
4630 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
4631 CVec_u8Z_free(ret_conv_8_var);
4632 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4639 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4640 CHECK(!owner->result_ok);
4641 return *owner->contents.err;
4643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4644 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4645 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4648 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4649 CHECK(owner->result_ok);
4650 return InMemorySigner_clone(&*owner->contents.result);
4652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4653 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4654 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4655 int64_t ret_ref = 0;
4656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4659 ret_ref = (uintptr_t)ret_var.inner;
4660 if (ret_var.is_owned) {
4666 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4667 CHECK(!owner->result_ok);
4668 return DecodeError_clone(&*owner->contents.err);
4670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4671 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4672 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4673 int64_t ret_ref = 0;
4674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4677 ret_ref = (uintptr_t)ret_var.inner;
4678 if (ret_var.is_owned) {
4684 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4685 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4686 for (size_t i = 0; i < ret.datalen; i++) {
4687 ret.data[i] = TxOut_clone(&orig->data[i]);
4691 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4692 CHECK(owner->result_ok);
4693 return *owner->contents.result;
4695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4696 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4697 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4698 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4699 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4703 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4704 CHECK(!owner->result_ok);
4705 return *owner->contents.err;
4707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4708 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4709 CResult_TransactionNoneZ_get_err(owner_conv);
4712 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4713 return ThirtyTwoBytes_clone(&owner->a);
4715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4716 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4717 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4718 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
4722 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4723 return ChannelMonitor_clone(&owner->b);
4725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4726 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4727 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
4728 int64_t ret_ref = 0;
4729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4732 ret_ref = (uintptr_t)ret_var.inner;
4733 if (ret_var.is_owned) {
4739 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
4740 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
4741 for (size_t i = 0; i < ret.datalen; i++) {
4742 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
4746 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4747 CHECK(owner->result_ok);
4748 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
4750 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4751 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4752 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
4753 int64_tArray ret_arr = NULL;
4754 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4755 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4756 for (size_t j = 0; j < ret_var.datalen; j++) {
4757 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4758 *ret_conv_35_conv = ret_var.data[j];
4759 ret_arr_ptr[j] = ((int64_t)ret_conv_35_conv);
4761 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4766 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4767 CHECK(!owner->result_ok);
4768 return *owner->contents.err;
4770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4771 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4772 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
4776 static jclass LDKCOption_u16Z_Some_class = NULL;
4777 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4778 static jclass LDKCOption_u16Z_None_class = NULL;
4779 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4781 LDKCOption_u16Z_Some_class =
4782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4783 CHECK(LDKCOption_u16Z_Some_class != NULL);
4784 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4785 CHECK(LDKCOption_u16Z_Some_meth != NULL);
4786 LDKCOption_u16Z_None_class =
4787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4788 CHECK(LDKCOption_u16Z_None_class != NULL);
4789 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4790 CHECK(LDKCOption_u16Z_None_meth != NULL);
4792 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4793 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4795 case LDKCOption_u16Z_Some: {
4796 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
4798 case LDKCOption_u16Z_None: {
4799 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4804 static jclass LDKAPIError_APIMisuseError_class = NULL;
4805 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
4806 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
4807 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
4808 static jclass LDKAPIError_RouteError_class = NULL;
4809 static jmethodID LDKAPIError_RouteError_meth = NULL;
4810 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
4811 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
4812 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
4813 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
4814 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
4815 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
4816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
4817 LDKAPIError_APIMisuseError_class =
4818 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
4819 CHECK(LDKAPIError_APIMisuseError_class != NULL);
4820 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
4821 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
4822 LDKAPIError_FeeRateTooHigh_class =
4823 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
4824 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
4825 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
4826 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
4827 LDKAPIError_RouteError_class =
4828 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
4829 CHECK(LDKAPIError_RouteError_class != NULL);
4830 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
4831 CHECK(LDKAPIError_RouteError_meth != NULL);
4832 LDKAPIError_ChannelUnavailable_class =
4833 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
4834 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
4835 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
4836 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
4837 LDKAPIError_MonitorUpdateFailed_class =
4838 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
4839 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
4840 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
4841 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
4842 LDKAPIError_IncompatibleShutdownScript_class =
4843 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
4844 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
4845 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
4846 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
4848 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4849 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4851 case LDKAPIError_APIMisuseError: {
4852 LDKStr err_str = obj->api_misuse_error.err;
4853 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4854 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
4856 case LDKAPIError_FeeRateTooHigh: {
4857 LDKStr err_str = obj->fee_rate_too_high.err;
4858 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4859 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
4861 case LDKAPIError_RouteError: {
4862 LDKStr err_str = obj->route_error.err;
4863 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4864 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
4866 case LDKAPIError_ChannelUnavailable: {
4867 LDKStr err_str = obj->channel_unavailable.err;
4868 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4869 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
4871 case LDKAPIError_MonitorUpdateFailed: {
4872 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
4874 case LDKAPIError_IncompatibleShutdownScript: {
4875 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4876 int64_t script_ref = 0;
4877 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4878 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4879 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4880 script_ref = (uintptr_t)script_var.inner & ~1;
4881 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
4886 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4887 CHECK(owner->result_ok);
4888 return *owner->contents.result;
4890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4891 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4892 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4895 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4896 CHECK(!owner->result_ok);
4897 return APIError_clone(&*owner->contents.err);
4899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4900 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4901 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4902 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4903 int64_t ret_ref = (uintptr_t)ret_copy;
4907 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4908 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4909 for (size_t i = 0; i < ret.datalen; i++) {
4910 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4914 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4915 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4916 for (size_t i = 0; i < ret.datalen; i++) {
4917 ret.data[i] = APIError_clone(&orig->data[i]);
4921 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4922 CHECK(owner->result_ok);
4923 return ThirtyTwoBytes_clone(&*owner->contents.result);
4925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4926 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4927 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4928 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
4932 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4933 CHECK(!owner->result_ok);
4934 return APIError_clone(&*owner->contents.err);
4936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4937 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4938 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4939 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4940 int64_t ret_ref = (uintptr_t)ret_copy;
4944 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
4945 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
4946 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
4947 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
4948 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
4949 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
4950 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
4951 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
4952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
4953 LDKPaymentSendFailure_ParameterError_class =
4954 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
4955 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
4956 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
4957 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
4958 LDKPaymentSendFailure_PathParameterError_class =
4959 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
4960 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
4961 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
4962 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
4963 LDKPaymentSendFailure_AllFailedRetrySafe_class =
4964 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
4965 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
4966 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
4967 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
4968 LDKPaymentSendFailure_PartialFailure_class =
4969 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
4970 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
4971 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
4972 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
4974 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4975 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4977 case LDKPaymentSendFailure_ParameterError: {
4978 int64_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
4979 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
4981 case LDKPaymentSendFailure_PathParameterError: {
4982 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4983 int64_tArray path_parameter_error_arr = NULL;
4984 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
4985 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
4986 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4987 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4988 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4989 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4990 path_parameter_error_arr_ptr[w] = (int64_t)path_parameter_error_conv_22_conv;
4992 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
4993 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
4995 case LDKPaymentSendFailure_AllFailedRetrySafe: {
4996 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4997 int64_tArray all_failed_retry_safe_arr = NULL;
4998 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
4999 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
5000 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5001 int64_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
5002 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5004 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
5005 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
5007 case LDKPaymentSendFailure_PartialFailure: {
5008 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5009 int64_tArray results_arr = NULL;
5010 results_arr = (*env)->NewLongArray(env, results_var.datalen);
5011 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
5012 for (size_t w = 0; w < results_var.datalen; w++) {
5013 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5014 *results_conv_22_conv = results_var.data[w];
5015 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5016 results_arr_ptr[w] = (int64_t)results_conv_22_conv;
5018 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
5019 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5020 int64_t failed_paths_retry_ref = 0;
5021 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
5022 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5023 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5024 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5025 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
5027 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5028 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
5029 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5034 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5035 CHECK(owner->result_ok);
5036 return ThirtyTwoBytes_clone(&*owner->contents.result);
5038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5039 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5040 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5041 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5045 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5046 CHECK(!owner->result_ok);
5047 return PaymentSendFailure_clone(&*owner->contents.err);
5049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5050 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5051 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5052 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5053 int64_t ret_ref = (uintptr_t)ret_copy;
5057 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5058 CHECK(owner->result_ok);
5059 return *owner->contents.result;
5061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5062 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5063 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5066 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5067 CHECK(!owner->result_ok);
5068 return PaymentSendFailure_clone(&*owner->contents.err);
5070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5071 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5072 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5073 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5074 int64_t ret_ref = (uintptr_t)ret_copy;
5078 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5079 return ThirtyTwoBytes_clone(&owner->a);
5081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5082 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5083 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5084 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5088 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5089 return ThirtyTwoBytes_clone(&owner->b);
5091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5092 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5093 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5094 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5098 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5099 CHECK(owner->result_ok);
5100 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5103 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5104 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5105 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5106 return ((int64_t)ret_conv);
5109 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5110 CHECK(!owner->result_ok);
5111 return PaymentSendFailure_clone(&*owner->contents.err);
5113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5114 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5115 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5116 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5117 int64_t ret_ref = (uintptr_t)ret_copy;
5121 static jclass LDKNetAddress_IPv4_class = NULL;
5122 static jmethodID LDKNetAddress_IPv4_meth = NULL;
5123 static jclass LDKNetAddress_IPv6_class = NULL;
5124 static jmethodID LDKNetAddress_IPv6_meth = NULL;
5125 static jclass LDKNetAddress_OnionV2_class = NULL;
5126 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
5127 static jclass LDKNetAddress_OnionV3_class = NULL;
5128 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
5129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
5130 LDKNetAddress_IPv4_class =
5131 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
5132 CHECK(LDKNetAddress_IPv4_class != NULL);
5133 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
5134 CHECK(LDKNetAddress_IPv4_meth != NULL);
5135 LDKNetAddress_IPv6_class =
5136 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
5137 CHECK(LDKNetAddress_IPv6_class != NULL);
5138 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
5139 CHECK(LDKNetAddress_IPv6_meth != NULL);
5140 LDKNetAddress_OnionV2_class =
5141 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
5142 CHECK(LDKNetAddress_OnionV2_class != NULL);
5143 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
5144 CHECK(LDKNetAddress_OnionV2_meth != NULL);
5145 LDKNetAddress_OnionV3_class =
5146 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
5147 CHECK(LDKNetAddress_OnionV3_class != NULL);
5148 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
5149 CHECK(LDKNetAddress_OnionV3_meth != NULL);
5151 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5152 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
5154 case LDKNetAddress_IPv4: {
5155 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
5156 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
5157 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
5159 case LDKNetAddress_IPv6: {
5160 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
5161 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
5162 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
5164 case LDKNetAddress_OnionV2: {
5165 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
5166 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
5167 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
5169 case LDKNetAddress_OnionV3: {
5170 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
5171 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
5172 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);
5177 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
5178 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
5179 for (size_t i = 0; i < ret.datalen; i++) {
5180 ret.data[i] = NetAddress_clone(&orig->data[i]);
5184 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5185 return ThirtyTwoBytes_clone(&owner->a);
5187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5188 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5189 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5190 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5194 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5195 return ThirtyTwoBytes_clone(&owner->b);
5197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5198 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5199 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5200 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5204 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5205 CHECK(owner->result_ok);
5206 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5209 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5210 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5211 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5212 return ((int64_t)ret_conv);
5215 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5216 CHECK(!owner->result_ok);
5217 return *owner->contents.err;
5219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5220 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5221 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5224 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5225 CHECK(owner->result_ok);
5226 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5229 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5230 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5231 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5232 return ((int64_t)ret_conv);
5235 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5236 CHECK(!owner->result_ok);
5237 return APIError_clone(&*owner->contents.err);
5239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5240 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5241 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5242 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5243 int64_t ret_ref = (uintptr_t)ret_copy;
5247 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5248 CHECK(owner->result_ok);
5249 return ThirtyTwoBytes_clone(&*owner->contents.result);
5251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5252 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5253 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5254 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5258 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5259 CHECK(!owner->result_ok);
5260 return *owner->contents.err;
5262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5263 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5264 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5267 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5268 CHECK(owner->result_ok);
5269 return ThirtyTwoBytes_clone(&*owner->contents.result);
5271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5272 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5273 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5274 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5278 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5279 CHECK(!owner->result_ok);
5280 return APIError_clone(&*owner->contents.err);
5282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5283 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5284 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5285 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5286 int64_t ret_ref = (uintptr_t)ret_copy;
5290 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5291 CHECK(owner->result_ok);
5292 return ThirtyTwoBytes_clone(&*owner->contents.result);
5294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5295 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5296 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5297 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
5301 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5302 CHECK(!owner->result_ok);
5303 return APIError_clone(&*owner->contents.err);
5305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5306 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5307 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5308 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5309 int64_t ret_ref = (uintptr_t)ret_copy;
5313 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5314 CHECK(owner->result_ok);
5315 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
5317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5318 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5319 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5320 int64_t ret_ref = 0;
5321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5324 ret_ref = (uintptr_t)ret_var.inner;
5325 if (ret_var.is_owned) {
5331 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5332 CHECK(!owner->result_ok);
5333 return DecodeError_clone(&*owner->contents.err);
5335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5336 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5337 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5338 int64_t ret_ref = 0;
5339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5342 ret_ref = (uintptr_t)ret_var.inner;
5343 if (ret_var.is_owned) {
5349 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5350 CHECK(owner->result_ok);
5351 return ChannelCounterparty_clone(&*owner->contents.result);
5353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5354 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5355 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5356 int64_t ret_ref = 0;
5357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5360 ret_ref = (uintptr_t)ret_var.inner;
5361 if (ret_var.is_owned) {
5367 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5368 CHECK(!owner->result_ok);
5369 return DecodeError_clone(&*owner->contents.err);
5371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5372 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5373 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5374 int64_t ret_ref = 0;
5375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5378 ret_ref = (uintptr_t)ret_var.inner;
5379 if (ret_var.is_owned) {
5385 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5386 CHECK(owner->result_ok);
5387 return ChannelDetails_clone(&*owner->contents.result);
5389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5390 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5391 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5392 int64_t ret_ref = 0;
5393 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5394 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5396 ret_ref = (uintptr_t)ret_var.inner;
5397 if (ret_var.is_owned) {
5403 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5404 CHECK(!owner->result_ok);
5405 return DecodeError_clone(&*owner->contents.err);
5407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5408 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5409 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5410 int64_t ret_ref = 0;
5411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5414 ret_ref = (uintptr_t)ret_var.inner;
5415 if (ret_var.is_owned) {
5421 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5422 CHECK(owner->result_ok);
5423 return PhantomRouteHints_clone(&*owner->contents.result);
5425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5426 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5427 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5428 int64_t ret_ref = 0;
5429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5432 ret_ref = (uintptr_t)ret_var.inner;
5433 if (ret_var.is_owned) {
5439 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5440 CHECK(!owner->result_ok);
5441 return DecodeError_clone(&*owner->contents.err);
5443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5444 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5445 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5446 int64_t ret_ref = 0;
5447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5450 ret_ref = (uintptr_t)ret_var.inner;
5451 if (ret_var.is_owned) {
5457 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5458 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5459 for (size_t i = 0; i < ret.datalen; i++) {
5460 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5464 typedef struct LDKWatch_JCalls {
5465 atomic_size_t refcnt;
5468 jmethodID watch_channel_meth;
5469 jmethodID update_channel_meth;
5470 jmethodID release_pending_monitor_events_meth;
5472 static void LDKWatch_JCalls_free(void* this_arg) {
5473 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5474 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5476 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5477 if (get_jenv_res == JNI_EDETACHED) {
5478 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5480 DO_ASSERT(get_jenv_res == JNI_OK);
5482 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5483 if (get_jenv_res == JNI_EDETACHED) {
5484 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5489 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5490 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5492 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5493 if (get_jenv_res == JNI_EDETACHED) {
5494 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5496 DO_ASSERT(get_jenv_res == JNI_OK);
5498 LDKOutPoint funding_txo_var = funding_txo;
5499 int64_t funding_txo_ref = 0;
5500 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5501 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5502 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5503 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5504 if (funding_txo_var.is_owned) {
5505 funding_txo_ref |= 1;
5507 LDKChannelMonitor monitor_var = monitor;
5508 int64_t monitor_ref = 0;
5509 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5510 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5511 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5512 monitor_ref = (uintptr_t)monitor_var.inner;
5513 if (monitor_var.is_owned) {
5516 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5518 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
5519 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5520 (*env)->ExceptionDescribe(env);
5521 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
5523 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5524 CHECK_ACCESS(ret_ptr);
5525 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5527 if (get_jenv_res == JNI_EDETACHED) {
5528 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5532 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5533 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5535 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5536 if (get_jenv_res == JNI_EDETACHED) {
5537 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5539 DO_ASSERT(get_jenv_res == JNI_OK);
5541 LDKOutPoint funding_txo_var = funding_txo;
5542 int64_t funding_txo_ref = 0;
5543 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5544 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5545 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5546 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5547 if (funding_txo_var.is_owned) {
5548 funding_txo_ref |= 1;
5550 LDKChannelMonitorUpdate update_var = update;
5551 int64_t update_ref = 0;
5552 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5553 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5554 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5555 update_ref = (uintptr_t)update_var.inner;
5556 if (update_var.is_owned) {
5559 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5561 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
5562 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5563 (*env)->ExceptionDescribe(env);
5564 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
5566 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5567 CHECK_ACCESS(ret_ptr);
5568 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5570 if (get_jenv_res == JNI_EDETACHED) {
5571 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5575 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5576 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5578 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5579 if (get_jenv_res == JNI_EDETACHED) {
5580 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5582 DO_ASSERT(get_jenv_res == JNI_OK);
5584 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5586 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
5587 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5588 (*env)->ExceptionDescribe(env);
5589 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
5591 LDKCVec_MonitorEventZ ret_constr;
5592 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5593 if (ret_constr.datalen > 0)
5594 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5596 ret_constr.data = NULL;
5597 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5598 for (size_t o = 0; o < ret_constr.datalen; o++) {
5599 int64_t ret_conv_14 = ret_vals[o];
5600 void* ret_conv_14_ptr = (void*)(((uintptr_t)ret_conv_14) & ~1);
5601 CHECK_ACCESS(ret_conv_14_ptr);
5602 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
5603 FREE((void*)ret_conv_14);
5604 ret_constr.data[o] = ret_conv_14_conv;
5606 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5607 if (get_jenv_res == JNI_EDETACHED) {
5608 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5612 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5613 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5614 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5616 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
5617 jclass c = (*env)->GetObjectClass(env, o);
5619 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5620 atomic_init(&calls->refcnt, 1);
5621 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5622 calls->o = (*env)->NewWeakGlobalRef(env, o);
5623 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
5624 CHECK(calls->watch_channel_meth != NULL);
5625 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
5626 CHECK(calls->update_channel_meth != NULL);
5627 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
5628 CHECK(calls->release_pending_monitor_events_meth != NULL);
5631 .this_arg = (void*) calls,
5632 .watch_channel = watch_channel_LDKWatch_jcall,
5633 .update_channel = update_channel_LDKWatch_jcall,
5634 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5635 .free = LDKWatch_JCalls_free,
5639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
5640 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5641 *res_ptr = LDKWatch_init(env, clz, o);
5642 return (uint64_t)res_ptr;
5644 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) {
5645 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5646 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5647 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5648 LDKOutPoint funding_txo_conv;
5649 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5650 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5651 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5652 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5653 LDKChannelMonitor monitor_conv;
5654 monitor_conv.inner = (void*)(monitor & (~1));
5655 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5656 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5657 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5658 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5659 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5660 return (int64_t)ret_conv;
5663 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) {
5664 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5665 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5666 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5667 LDKOutPoint funding_txo_conv;
5668 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5669 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5670 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5671 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5672 LDKChannelMonitorUpdate update_conv;
5673 update_conv.inner = (void*)(update & (~1));
5674 update_conv.is_owned = (update & 1) || (update == 0);
5675 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5676 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5677 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5678 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5679 return (int64_t)ret_conv;
5682 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
5683 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5684 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5685 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5686 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5687 int64_tArray ret_arr = NULL;
5688 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5689 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5690 for (size_t o = 0; o < ret_var.datalen; o++) {
5691 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5692 *ret_conv_14_copy = ret_var.data[o];
5693 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
5694 ret_arr_ptr[o] = ret_conv_14_ref;
5696 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5701 typedef struct LDKBroadcasterInterface_JCalls {
5702 atomic_size_t refcnt;
5705 jmethodID broadcast_transaction_meth;
5706 } LDKBroadcasterInterface_JCalls;
5707 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5708 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5709 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5711 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5712 if (get_jenv_res == JNI_EDETACHED) {
5713 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5715 DO_ASSERT(get_jenv_res == JNI_OK);
5717 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5718 if (get_jenv_res == JNI_EDETACHED) {
5719 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5724 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5725 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5727 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5728 if (get_jenv_res == JNI_EDETACHED) {
5729 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5731 DO_ASSERT(get_jenv_res == JNI_OK);
5733 LDKTransaction tx_var = tx;
5734 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
5735 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
5736 Transaction_free(tx_var);
5737 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5739 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
5740 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5741 (*env)->ExceptionDescribe(env);
5742 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
5744 if (get_jenv_res == JNI_EDETACHED) {
5745 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5748 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5749 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5750 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5752 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
5753 jclass c = (*env)->GetObjectClass(env, o);
5755 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5756 atomic_init(&calls->refcnt, 1);
5757 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5758 calls->o = (*env)->NewWeakGlobalRef(env, o);
5759 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
5760 CHECK(calls->broadcast_transaction_meth != NULL);
5762 LDKBroadcasterInterface ret = {
5763 .this_arg = (void*) calls,
5764 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5765 .free = LDKBroadcasterInterface_JCalls_free,
5769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
5770 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5771 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
5772 return (uint64_t)res_ptr;
5774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
5775 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5776 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5777 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5778 LDKTransaction tx_ref;
5779 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
5780 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5781 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
5782 tx_ref.data_is_owned = true;
5783 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5786 typedef struct LDKKeysInterface_JCalls {
5787 atomic_size_t refcnt;
5790 jmethodID get_node_secret_meth;
5791 jmethodID get_destination_script_meth;
5792 jmethodID get_shutdown_scriptpubkey_meth;
5793 jmethodID get_channel_signer_meth;
5794 jmethodID get_secure_random_bytes_meth;
5795 jmethodID read_chan_signer_meth;
5796 jmethodID sign_invoice_meth;
5797 jmethodID get_inbound_payment_key_material_meth;
5798 } LDKKeysInterface_JCalls;
5799 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5800 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5801 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5803 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5804 if (get_jenv_res == JNI_EDETACHED) {
5805 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5807 DO_ASSERT(get_jenv_res == JNI_OK);
5809 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5810 if (get_jenv_res == JNI_EDETACHED) {
5811 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5816 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5817 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5819 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5820 if (get_jenv_res == JNI_EDETACHED) {
5821 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5823 DO_ASSERT(get_jenv_res == JNI_OK);
5825 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
5826 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5828 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
5829 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5830 (*env)->ExceptionDescribe(env);
5831 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
5833 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5834 CHECK_ACCESS(ret_ptr);
5835 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5837 if (get_jenv_res == JNI_EDETACHED) {
5838 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5842 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5843 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5845 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5846 if (get_jenv_res == JNI_EDETACHED) {
5847 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5849 DO_ASSERT(get_jenv_res == JNI_OK);
5851 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5853 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
5854 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5855 (*env)->ExceptionDescribe(env);
5856 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
5858 LDKCVec_u8Z ret_ref;
5859 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5860 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5861 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5862 if (get_jenv_res == JNI_EDETACHED) {
5863 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5867 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5868 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5870 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5871 if (get_jenv_res == JNI_EDETACHED) {
5872 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5874 DO_ASSERT(get_jenv_res == JNI_OK);
5876 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5878 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
5879 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5880 (*env)->ExceptionDescribe(env);
5881 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
5883 LDKShutdownScript ret_conv;
5884 ret_conv.inner = (void*)(ret & (~1));
5885 ret_conv.is_owned = (ret & 1) || (ret == 0);
5886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5887 if (get_jenv_res == JNI_EDETACHED) {
5888 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5892 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5893 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5895 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5896 if (get_jenv_res == JNI_EDETACHED) {
5897 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5899 DO_ASSERT(get_jenv_res == JNI_OK);
5901 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5903 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
5904 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5905 (*env)->ExceptionDescribe(env);
5906 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
5908 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5909 CHECK_ACCESS(ret_ptr);
5910 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5912 if (get_jenv_res == JNI_EDETACHED) {
5913 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5917 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5918 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5920 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5921 if (get_jenv_res == JNI_EDETACHED) {
5922 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5924 DO_ASSERT(get_jenv_res == JNI_OK);
5926 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5928 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
5929 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5930 (*env)->ExceptionDescribe(env);
5931 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
5933 LDKThirtyTwoBytes ret_ref;
5934 CHECK((*env)->GetArrayLength(env, ret) == 32);
5935 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5936 if (get_jenv_res == JNI_EDETACHED) {
5937 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5941 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5942 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5944 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5945 if (get_jenv_res == JNI_EDETACHED) {
5946 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5948 DO_ASSERT(get_jenv_res == JNI_OK);
5950 LDKu8slice reader_var = reader;
5951 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
5952 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
5953 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5955 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
5956 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5957 (*env)->ExceptionDescribe(env);
5958 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
5960 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5961 CHECK_ACCESS(ret_ptr);
5962 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5964 if (get_jenv_res == JNI_EDETACHED) {
5965 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5969 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5970 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5972 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5973 if (get_jenv_res == JNI_EDETACHED) {
5974 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5976 DO_ASSERT(get_jenv_res == JNI_OK);
5978 LDKu8slice hrp_bytes_var = hrp_bytes;
5979 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
5980 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
5981 LDKCVec_u5Z invoice_data_var = invoice_data;
5982 jobjectArray invoice_data_arr = NULL;
5983 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
5984 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
5985 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5986 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5987 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5989 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
5990 FREE(invoice_data_var.data);
5991 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
5992 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5994 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
5995 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5996 (*env)->ExceptionDescribe(env);
5997 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
5999 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6000 CHECK_ACCESS(ret_ptr);
6001 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6003 if (get_jenv_res == JNI_EDETACHED) {
6004 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6008 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6009 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6011 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6012 if (get_jenv_res == JNI_EDETACHED) {
6013 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6015 DO_ASSERT(get_jenv_res == JNI_OK);
6017 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6019 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
6020 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6021 (*env)->ExceptionDescribe(env);
6022 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
6024 LDKThirtyTwoBytes ret_ref;
6025 CHECK((*env)->GetArrayLength(env, ret) == 32);
6026 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6027 if (get_jenv_res == JNI_EDETACHED) {
6028 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6032 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6033 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6034 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6036 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6037 jclass c = (*env)->GetObjectClass(env, o);
6039 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6040 atomic_init(&calls->refcnt, 1);
6041 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6042 calls->o = (*env)->NewWeakGlobalRef(env, o);
6043 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6044 CHECK(calls->get_node_secret_meth != NULL);
6045 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6046 CHECK(calls->get_destination_script_meth != NULL);
6047 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6048 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6049 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6050 CHECK(calls->get_channel_signer_meth != NULL);
6051 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6052 CHECK(calls->get_secure_random_bytes_meth != NULL);
6053 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6054 CHECK(calls->read_chan_signer_meth != NULL);
6055 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6056 CHECK(calls->sign_invoice_meth != NULL);
6057 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6058 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6060 LDKKeysInterface ret = {
6061 .this_arg = (void*) calls,
6062 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6063 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6064 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6065 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6066 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6067 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6068 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6069 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6070 .free = LDKKeysInterface_JCalls_free,
6074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6075 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6076 *res_ptr = LDKKeysInterface_init(env, clz, o);
6077 return (uint64_t)res_ptr;
6079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6080 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6081 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6082 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6083 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6084 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6085 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6086 return (int64_t)ret_conv;
6089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6090 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6091 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6092 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6093 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6094 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6095 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6096 CVec_u8Z_free(ret_var);
6100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6101 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6102 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6103 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6104 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6105 int64_t ret_ref = 0;
6106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6109 ret_ref = (uintptr_t)ret_var.inner;
6110 if (ret_var.is_owned) {
6116 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) {
6117 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6118 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6119 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6120 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6121 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6122 return (int64_t)ret_ret;
6125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6126 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6127 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6128 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6129 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6130 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6135 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6136 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6137 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6138 LDKu8slice reader_ref;
6139 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6140 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6141 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6142 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6143 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6144 return (int64_t)ret_conv;
6147 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) {
6148 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6149 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6150 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6151 LDKu8slice hrp_bytes_ref;
6152 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6153 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6154 LDKCVec_u5Z invoice_data_constr;
6155 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6156 if (invoice_data_constr.datalen > 0)
6157 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6159 invoice_data_constr.data = NULL;
6160 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6161 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6162 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6164 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6166 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6167 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6168 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6169 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6170 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6171 return (int64_t)ret_conv;
6174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6175 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6176 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6177 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6178 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6179 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6183 typedef struct LDKFeeEstimator_JCalls {
6184 atomic_size_t refcnt;
6187 jmethodID get_est_sat_per_1000_weight_meth;
6188 } LDKFeeEstimator_JCalls;
6189 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6190 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6191 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6193 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6194 if (get_jenv_res == JNI_EDETACHED) {
6195 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6197 DO_ASSERT(get_jenv_res == JNI_OK);
6199 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6200 if (get_jenv_res == JNI_EDETACHED) {
6201 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6206 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6207 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6209 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6210 if (get_jenv_res == JNI_EDETACHED) {
6211 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6213 DO_ASSERT(get_jenv_res == JNI_OK);
6215 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6216 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6218 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6219 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6220 (*env)->ExceptionDescribe(env);
6221 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6223 if (get_jenv_res == JNI_EDETACHED) {
6224 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6228 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6229 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6230 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6232 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6233 jclass c = (*env)->GetObjectClass(env, o);
6235 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6236 atomic_init(&calls->refcnt, 1);
6237 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6238 calls->o = (*env)->NewWeakGlobalRef(env, o);
6239 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6240 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6242 LDKFeeEstimator ret = {
6243 .this_arg = (void*) calls,
6244 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6245 .free = LDKFeeEstimator_JCalls_free,
6249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6250 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6251 *res_ptr = LDKFeeEstimator_init(env, clz, o);
6252 return (uint64_t)res_ptr;
6254 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) {
6255 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6256 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6257 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6258 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6259 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6263 typedef struct LDKLogger_JCalls {
6264 atomic_size_t refcnt;
6269 static void LDKLogger_JCalls_free(void* this_arg) {
6270 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6271 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6273 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6274 if (get_jenv_res == JNI_EDETACHED) {
6275 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6277 DO_ASSERT(get_jenv_res == JNI_OK);
6279 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6280 if (get_jenv_res == JNI_EDETACHED) {
6281 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6286 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6287 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6289 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6290 if (get_jenv_res == JNI_EDETACHED) {
6291 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6293 DO_ASSERT(get_jenv_res == JNI_OK);
6295 LDKRecord record_var = *record;
6296 int64_t record_ref = 0;
6297 record_var = Record_clone(&record_var);
6298 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6299 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6300 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6301 record_ref = (uintptr_t)record_var.inner;
6302 if (record_var.is_owned) {
6305 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6307 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
6308 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6309 (*env)->ExceptionDescribe(env);
6310 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
6312 if (get_jenv_res == JNI_EDETACHED) {
6313 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6316 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6317 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6318 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6320 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
6321 jclass c = (*env)->GetObjectClass(env, o);
6323 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6324 atomic_init(&calls->refcnt, 1);
6325 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6326 calls->o = (*env)->NewWeakGlobalRef(env, o);
6327 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
6328 CHECK(calls->log_meth != NULL);
6331 .this_arg = (void*) calls,
6332 .log = log_LDKLogger_jcall,
6333 .free = LDKLogger_JCalls_free,
6337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
6338 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6339 *res_ptr = LDKLogger_init(env, clz, o);
6340 return (uint64_t)res_ptr;
6342 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6343 return ThirtyTwoBytes_clone(&owner->a);
6345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6346 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6347 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6348 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6352 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6356 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6357 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6358 int64_t ret_ref = 0;
6359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6362 ret_ref = (uintptr_t)ret_var.inner & ~1;
6366 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6367 CHECK(owner->result_ok);
6368 return &*owner->contents.result;
6370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6371 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6372 int64_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
6376 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6377 CHECK(!owner->result_ok);
6378 return DecodeError_clone(&*owner->contents.err);
6380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6381 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6382 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6383 int64_t ret_ref = 0;
6384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6387 ret_ref = (uintptr_t)ret_var.inner;
6388 if (ret_var.is_owned) {
6394 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6395 CHECK(owner->result_ok);
6396 return ChannelConfig_clone(&*owner->contents.result);
6398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6399 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6400 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6401 int64_t ret_ref = 0;
6402 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6403 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6405 ret_ref = (uintptr_t)ret_var.inner;
6406 if (ret_var.is_owned) {
6412 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6413 CHECK(!owner->result_ok);
6414 return DecodeError_clone(&*owner->contents.err);
6416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6417 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6418 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6419 int64_t ret_ref = 0;
6420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6423 ret_ref = (uintptr_t)ret_var.inner;
6424 if (ret_var.is_owned) {
6430 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6431 CHECK(owner->result_ok);
6432 return OutPoint_clone(&*owner->contents.result);
6434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6435 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6436 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6437 int64_t ret_ref = 0;
6438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6441 ret_ref = (uintptr_t)ret_var.inner;
6442 if (ret_var.is_owned) {
6448 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6449 CHECK(!owner->result_ok);
6450 return DecodeError_clone(&*owner->contents.err);
6452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6453 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6454 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6455 int64_t ret_ref = 0;
6456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6459 ret_ref = (uintptr_t)ret_var.inner;
6460 if (ret_var.is_owned) {
6466 typedef struct LDKType_JCalls {
6467 atomic_size_t refcnt;
6470 jmethodID type_id_meth;
6471 jmethodID debug_str_meth;
6472 jmethodID write_meth;
6474 static void LDKType_JCalls_free(void* this_arg) {
6475 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6476 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6478 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6479 if (get_jenv_res == JNI_EDETACHED) {
6480 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6482 DO_ASSERT(get_jenv_res == JNI_OK);
6484 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6485 if (get_jenv_res == JNI_EDETACHED) {
6486 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6491 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6492 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6494 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6495 if (get_jenv_res == JNI_EDETACHED) {
6496 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6498 DO_ASSERT(get_jenv_res == JNI_OK);
6500 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6502 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
6503 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6504 (*env)->ExceptionDescribe(env);
6505 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
6507 if (get_jenv_res == JNI_EDETACHED) {
6508 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6512 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6513 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6515 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6516 if (get_jenv_res == JNI_EDETACHED) {
6517 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6519 DO_ASSERT(get_jenv_res == JNI_OK);
6521 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6523 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
6524 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6525 (*env)->ExceptionDescribe(env);
6526 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
6528 LDKStr ret_conv = java_to_owned_str(env, ret);
6529 if (get_jenv_res == JNI_EDETACHED) {
6530 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6534 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6535 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6537 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6538 if (get_jenv_res == JNI_EDETACHED) {
6539 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6541 DO_ASSERT(get_jenv_res == JNI_OK);
6543 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6545 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6546 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6547 (*env)->ExceptionDescribe(env);
6548 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
6550 LDKCVec_u8Z ret_ref;
6551 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6552 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6553 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6554 if (get_jenv_res == JNI_EDETACHED) {
6555 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6559 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6560 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6561 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6563 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
6564 jclass c = (*env)->GetObjectClass(env, o);
6566 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6567 atomic_init(&calls->refcnt, 1);
6568 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6569 calls->o = (*env)->NewWeakGlobalRef(env, o);
6570 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
6571 CHECK(calls->type_id_meth != NULL);
6572 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
6573 CHECK(calls->debug_str_meth != NULL);
6574 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
6575 CHECK(calls->write_meth != NULL);
6578 .this_arg = (void*) calls,
6579 .type_id = type_id_LDKType_jcall,
6580 .debug_str = debug_str_LDKType_jcall,
6581 .write = write_LDKType_jcall,
6582 .cloned = LDKType_JCalls_cloned,
6583 .free = LDKType_JCalls_free,
6587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
6588 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6589 *res_ptr = LDKType_init(env, clz, o);
6590 return (uint64_t)res_ptr;
6592 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
6593 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6594 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6595 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6596 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6600 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
6601 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6602 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6603 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6604 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6605 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
6611 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6612 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6613 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6614 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6615 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6616 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6617 CVec_u8Z_free(ret_var);
6621 static jclass LDKCOption_TypeZ_Some_class = NULL;
6622 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
6623 static jclass LDKCOption_TypeZ_None_class = NULL;
6624 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
6625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
6626 LDKCOption_TypeZ_Some_class =
6627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
6628 CHECK(LDKCOption_TypeZ_Some_class != NULL);
6629 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
6630 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
6631 LDKCOption_TypeZ_None_class =
6632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
6633 CHECK(LDKCOption_TypeZ_None_class != NULL);
6634 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
6635 CHECK(LDKCOption_TypeZ_None_meth != NULL);
6637 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6638 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
6640 case LDKCOption_TypeZ_Some: {
6641 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6642 *some_ret = Type_clone(&obj->some);
6643 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (int64_t)some_ret);
6645 case LDKCOption_TypeZ_None: {
6646 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
6651 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6652 CHECK(owner->result_ok);
6653 return COption_TypeZ_clone(&*owner->contents.result);
6655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6656 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6657 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6658 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6659 int64_t ret_ref = (uintptr_t)ret_copy;
6663 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6664 CHECK(!owner->result_ok);
6665 return DecodeError_clone(&*owner->contents.err);
6667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6668 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6669 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6670 int64_t ret_ref = 0;
6671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6674 ret_ref = (uintptr_t)ret_var.inner;
6675 if (ret_var.is_owned) {
6681 static jclass LDKPaymentError_Invoice_class = NULL;
6682 static jmethodID LDKPaymentError_Invoice_meth = NULL;
6683 static jclass LDKPaymentError_Routing_class = NULL;
6684 static jmethodID LDKPaymentError_Routing_meth = NULL;
6685 static jclass LDKPaymentError_Sending_class = NULL;
6686 static jmethodID LDKPaymentError_Sending_meth = NULL;
6687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
6688 LDKPaymentError_Invoice_class =
6689 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
6690 CHECK(LDKPaymentError_Invoice_class != NULL);
6691 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
6692 CHECK(LDKPaymentError_Invoice_meth != NULL);
6693 LDKPaymentError_Routing_class =
6694 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
6695 CHECK(LDKPaymentError_Routing_class != NULL);
6696 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
6697 CHECK(LDKPaymentError_Routing_meth != NULL);
6698 LDKPaymentError_Sending_class =
6699 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
6700 CHECK(LDKPaymentError_Sending_class != NULL);
6701 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
6702 CHECK(LDKPaymentError_Sending_meth != NULL);
6704 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6705 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6707 case LDKPaymentError_Invoice: {
6708 LDKStr invoice_str = obj->invoice;
6709 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
6710 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
6712 case LDKPaymentError_Routing: {
6713 LDKLightningError routing_var = obj->routing;
6714 int64_t routing_ref = 0;
6715 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6716 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6717 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
6718 routing_ref = (uintptr_t)routing_var.inner & ~1;
6719 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
6721 case LDKPaymentError_Sending: {
6722 int64_t sending_ref = ((uintptr_t)&obj->sending) | 1;
6723 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
6728 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6729 CHECK(owner->result_ok);
6730 return ThirtyTwoBytes_clone(&*owner->contents.result);
6732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6733 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6734 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6735 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
6739 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6740 CHECK(!owner->result_ok);
6741 return PaymentError_clone(&*owner->contents.err);
6743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6744 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6745 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6746 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6747 int64_t ret_ref = (uintptr_t)ret_copy;
6751 static jclass LDKParseError_Bech32Error_class = NULL;
6752 static jmethodID LDKParseError_Bech32Error_meth = NULL;
6753 static jclass LDKParseError_ParseAmountError_class = NULL;
6754 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
6755 static jclass LDKParseError_MalformedSignature_class = NULL;
6756 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
6757 static jclass LDKParseError_BadPrefix_class = NULL;
6758 static jmethodID LDKParseError_BadPrefix_meth = NULL;
6759 static jclass LDKParseError_UnknownCurrency_class = NULL;
6760 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
6761 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
6762 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
6763 static jclass LDKParseError_MalformedHRP_class = NULL;
6764 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
6765 static jclass LDKParseError_TooShortDataPart_class = NULL;
6766 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
6767 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
6768 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
6769 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
6770 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
6771 static jclass LDKParseError_PaddingError_class = NULL;
6772 static jmethodID LDKParseError_PaddingError_meth = NULL;
6773 static jclass LDKParseError_IntegerOverflowError_class = NULL;
6774 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
6775 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
6776 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
6777 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
6778 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
6779 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
6780 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
6781 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
6782 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
6783 static jclass LDKParseError_InvalidSliceLength_class = NULL;
6784 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
6785 static jclass LDKParseError_Skip_class = NULL;
6786 static jmethodID LDKParseError_Skip_meth = NULL;
6787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
6788 LDKParseError_Bech32Error_class =
6789 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
6790 CHECK(LDKParseError_Bech32Error_class != NULL);
6791 LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
6792 CHECK(LDKParseError_Bech32Error_meth != NULL);
6793 LDKParseError_ParseAmountError_class =
6794 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
6795 CHECK(LDKParseError_ParseAmountError_class != NULL);
6796 LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
6797 CHECK(LDKParseError_ParseAmountError_meth != NULL);
6798 LDKParseError_MalformedSignature_class =
6799 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
6800 CHECK(LDKParseError_MalformedSignature_class != NULL);
6801 LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
6802 CHECK(LDKParseError_MalformedSignature_meth != NULL);
6803 LDKParseError_BadPrefix_class =
6804 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
6805 CHECK(LDKParseError_BadPrefix_class != NULL);
6806 LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
6807 CHECK(LDKParseError_BadPrefix_meth != NULL);
6808 LDKParseError_UnknownCurrency_class =
6809 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
6810 CHECK(LDKParseError_UnknownCurrency_class != NULL);
6811 LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
6812 CHECK(LDKParseError_UnknownCurrency_meth != NULL);
6813 LDKParseError_UnknownSiPrefix_class =
6814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
6815 CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
6816 LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
6817 CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
6818 LDKParseError_MalformedHRP_class =
6819 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
6820 CHECK(LDKParseError_MalformedHRP_class != NULL);
6821 LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
6822 CHECK(LDKParseError_MalformedHRP_meth != NULL);
6823 LDKParseError_TooShortDataPart_class =
6824 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
6825 CHECK(LDKParseError_TooShortDataPart_class != NULL);
6826 LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
6827 CHECK(LDKParseError_TooShortDataPart_meth != NULL);
6828 LDKParseError_UnexpectedEndOfTaggedFields_class =
6829 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
6830 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
6831 LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
6832 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
6833 LDKParseError_DescriptionDecodeError_class =
6834 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
6835 CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
6836 LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
6837 CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
6838 LDKParseError_PaddingError_class =
6839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
6840 CHECK(LDKParseError_PaddingError_class != NULL);
6841 LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
6842 CHECK(LDKParseError_PaddingError_meth != NULL);
6843 LDKParseError_IntegerOverflowError_class =
6844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
6845 CHECK(LDKParseError_IntegerOverflowError_class != NULL);
6846 LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
6847 CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
6848 LDKParseError_InvalidSegWitProgramLength_class =
6849 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
6850 CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
6851 LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
6852 CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
6853 LDKParseError_InvalidPubKeyHashLength_class =
6854 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
6855 CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
6856 LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
6857 CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
6858 LDKParseError_InvalidScriptHashLength_class =
6859 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
6860 CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
6861 LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
6862 CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
6863 LDKParseError_InvalidRecoveryId_class =
6864 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
6865 CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
6866 LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
6867 CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
6868 LDKParseError_InvalidSliceLength_class =
6869 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
6870 CHECK(LDKParseError_InvalidSliceLength_class != NULL);
6871 LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
6872 CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
6873 LDKParseError_Skip_class =
6874 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
6875 CHECK(LDKParseError_Skip_class != NULL);
6876 LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
6877 CHECK(LDKParseError_Skip_meth != NULL);
6879 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6880 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6882 case LDKParseError_Bech32Error: {
6883 int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
6884 return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
6886 case LDKParseError_ParseAmountError: {
6887 /*obj->parse_amount_error*/
6888 return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
6890 case LDKParseError_MalformedSignature: {
6891 jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
6892 return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
6894 case LDKParseError_BadPrefix: {
6895 return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
6897 case LDKParseError_UnknownCurrency: {
6898 return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
6900 case LDKParseError_UnknownSiPrefix: {
6901 return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
6903 case LDKParseError_MalformedHRP: {
6904 return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
6906 case LDKParseError_TooShortDataPart: {
6907 return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
6909 case LDKParseError_UnexpectedEndOfTaggedFields: {
6910 return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
6912 case LDKParseError_DescriptionDecodeError: {
6913 /*obj->description_decode_error*/
6914 return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
6916 case LDKParseError_PaddingError: {
6917 return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
6919 case LDKParseError_IntegerOverflowError: {
6920 return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
6922 case LDKParseError_InvalidSegWitProgramLength: {
6923 return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
6925 case LDKParseError_InvalidPubKeyHashLength: {
6926 return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
6928 case LDKParseError_InvalidScriptHashLength: {
6929 return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
6931 case LDKParseError_InvalidRecoveryId: {
6932 return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
6934 case LDKParseError_InvalidSliceLength: {
6935 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
6936 jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
6937 return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
6939 case LDKParseError_Skip: {
6940 return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
6945 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6946 CHECK(owner->result_ok);
6947 return SiPrefix_clone(&*owner->contents.result);
6949 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6950 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
6951 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
6955 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6956 CHECK(!owner->result_ok);
6957 return ParseError_clone(&*owner->contents.err);
6959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6960 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
6961 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6962 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
6963 int64_t ret_ref = (uintptr_t)ret_copy;
6967 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
6968 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
6969 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
6970 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
6971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
6972 LDKParseOrSemanticError_ParseError_class =
6973 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
6974 CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
6975 LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
6976 CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
6977 LDKParseOrSemanticError_SemanticError_class =
6978 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
6979 CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
6980 LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
6981 CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
6983 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6984 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
6986 case LDKParseOrSemanticError_ParseError: {
6987 int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
6988 return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
6990 case LDKParseOrSemanticError_SemanticError: {
6991 jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
6992 return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
6997 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
6998 CHECK(owner->result_ok);
6999 return Invoice_clone(&*owner->contents.result);
7001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7002 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7003 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7004 int64_t ret_ref = 0;
7005 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7006 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7008 ret_ref = (uintptr_t)ret_var.inner;
7009 if (ret_var.is_owned) {
7015 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7016 CHECK(!owner->result_ok);
7017 return ParseOrSemanticError_clone(&*owner->contents.err);
7019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7020 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7021 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7022 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7023 int64_t ret_ref = (uintptr_t)ret_copy;
7027 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7028 CHECK(owner->result_ok);
7029 return SignedRawInvoice_clone(&*owner->contents.result);
7031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7032 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7033 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7034 int64_t ret_ref = 0;
7035 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7036 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7038 ret_ref = (uintptr_t)ret_var.inner;
7039 if (ret_var.is_owned) {
7045 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7046 CHECK(!owner->result_ok);
7047 return ParseError_clone(&*owner->contents.err);
7049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7050 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7051 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7052 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7053 int64_t ret_ref = (uintptr_t)ret_copy;
7057 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7058 return RawInvoice_clone(&owner->a);
7060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7061 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7062 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7063 int64_t ret_ref = 0;
7064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7067 ret_ref = (uintptr_t)ret_var.inner;
7068 if (ret_var.is_owned) {
7074 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7075 return ThirtyTwoBytes_clone(&owner->b);
7077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7078 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7079 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7080 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
7084 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7085 return InvoiceSignature_clone(&owner->c);
7087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7088 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7089 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7090 int64_t ret_ref = 0;
7091 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7092 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7094 ret_ref = (uintptr_t)ret_var.inner;
7095 if (ret_var.is_owned) {
7101 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7102 CHECK(owner->result_ok);
7103 return PayeePubKey_clone(&*owner->contents.result);
7105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7106 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7107 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7108 int64_t ret_ref = 0;
7109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7112 ret_ref = (uintptr_t)ret_var.inner;
7113 if (ret_var.is_owned) {
7119 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7120 CHECK(!owner->result_ok);
7121 return *owner->contents.err;
7123 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7124 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7125 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7129 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7130 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7131 for (size_t i = 0; i < ret.datalen; i++) {
7132 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7136 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7137 CHECK(owner->result_ok);
7138 return PositiveTimestamp_clone(&*owner->contents.result);
7140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7141 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7142 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(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 enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7155 CHECK(!owner->result_ok);
7156 return CreationError_clone(&*owner->contents.err);
7158 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7159 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7160 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7164 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7165 CHECK(owner->result_ok);
7166 return *owner->contents.result;
7168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7169 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7170 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7173 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7174 CHECK(!owner->result_ok);
7175 return SemanticError_clone(&*owner->contents.err);
7177 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7178 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7179 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
7183 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7184 CHECK(owner->result_ok);
7185 return Invoice_clone(&*owner->contents.result);
7187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7188 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7189 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7190 int64_t ret_ref = 0;
7191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7194 ret_ref = (uintptr_t)ret_var.inner;
7195 if (ret_var.is_owned) {
7201 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7202 CHECK(!owner->result_ok);
7203 return SemanticError_clone(&*owner->contents.err);
7205 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7206 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7207 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7211 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7212 CHECK(owner->result_ok);
7213 return Description_clone(&*owner->contents.result);
7215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7216 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7217 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7218 int64_t ret_ref = 0;
7219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7222 ret_ref = (uintptr_t)ret_var.inner;
7223 if (ret_var.is_owned) {
7229 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7230 CHECK(!owner->result_ok);
7231 return CreationError_clone(&*owner->contents.err);
7233 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7234 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7235 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7239 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7240 CHECK(owner->result_ok);
7241 return PrivateRoute_clone(&*owner->contents.result);
7243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7244 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
7245 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7246 int64_t ret_ref = 0;
7247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7250 ret_ref = (uintptr_t)ret_var.inner;
7251 if (ret_var.is_owned) {
7257 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7258 CHECK(!owner->result_ok);
7259 return CreationError_clone(&*owner->contents.err);
7261 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7262 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
7263 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7267 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7268 CHECK(owner->result_ok);
7269 return *owner->contents.result;
7271 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7272 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7273 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7274 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7278 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7279 CHECK(!owner->result_ok);
7280 return *owner->contents.err;
7282 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7283 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7284 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
7288 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7289 CHECK(owner->result_ok);
7290 return ChannelMonitorUpdate_clone(&*owner->contents.result);
7292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7293 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7294 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7295 int64_t ret_ref = 0;
7296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7299 ret_ref = (uintptr_t)ret_var.inner;
7300 if (ret_var.is_owned) {
7306 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7307 CHECK(!owner->result_ok);
7308 return DecodeError_clone(&*owner->contents.err);
7310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7311 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7312 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7313 int64_t ret_ref = 0;
7314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7317 ret_ref = (uintptr_t)ret_var.inner;
7318 if (ret_var.is_owned) {
7324 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
7325 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
7326 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
7327 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
7328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
7329 LDKCOption_MonitorEventZ_Some_class =
7330 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
7331 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7332 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7333 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7334 LDKCOption_MonitorEventZ_None_class =
7335 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7336 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7337 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7338 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7340 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7341 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
7343 case LDKCOption_MonitorEventZ_Some: {
7344 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
7345 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7347 case LDKCOption_MonitorEventZ_None: {
7348 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7353 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7354 CHECK(owner->result_ok);
7355 return COption_MonitorEventZ_clone(&*owner->contents.result);
7357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7358 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7359 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7360 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7361 int64_t ret_ref = (uintptr_t)ret_copy;
7365 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7366 CHECK(!owner->result_ok);
7367 return DecodeError_clone(&*owner->contents.err);
7369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7370 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7371 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7372 int64_t ret_ref = 0;
7373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7376 ret_ref = (uintptr_t)ret_var.inner;
7377 if (ret_var.is_owned) {
7383 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7384 CHECK(owner->result_ok);
7385 return HTLCUpdate_clone(&*owner->contents.result);
7387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7388 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7389 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7390 int64_t ret_ref = 0;
7391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7394 ret_ref = (uintptr_t)ret_var.inner;
7395 if (ret_var.is_owned) {
7401 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7402 CHECK(!owner->result_ok);
7403 return DecodeError_clone(&*owner->contents.err);
7405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7406 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7407 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7408 int64_t ret_ref = 0;
7409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7412 ret_ref = (uintptr_t)ret_var.inner;
7413 if (ret_var.is_owned) {
7419 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7420 return OutPoint_clone(&owner->a);
7422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7423 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7424 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7425 int64_t ret_ref = 0;
7426 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7427 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7429 ret_ref = (uintptr_t)ret_var.inner;
7430 if (ret_var.is_owned) {
7436 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7437 return CVec_u8Z_clone(&owner->b);
7439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7440 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7441 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7442 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7443 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7444 CVec_u8Z_free(ret_var);
7448 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7451 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7452 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7453 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
7457 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7458 return CVec_u8Z_clone(&owner->b);
7460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7461 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7462 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7463 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7464 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7465 CVec_u8Z_free(ret_var);
7469 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7470 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7471 for (size_t i = 0; i < ret.datalen; i++) {
7472 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7476 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7477 return ThirtyTwoBytes_clone(&owner->a);
7479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7480 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7481 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7482 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
7486 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7487 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7489 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7490 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7491 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7492 int64_tArray ret_arr = NULL;
7493 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7494 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7495 for (size_t v = 0; v < ret_var.datalen; v++) {
7496 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7497 *ret_conv_21_conv = ret_var.data[v];
7498 ret_arr_ptr[v] = ((int64_t)ret_conv_21_conv);
7500 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7505 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
7506 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 };
7507 for (size_t i = 0; i < ret.datalen; i++) {
7508 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
7512 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
7513 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
7514 for (size_t i = 0; i < ret.datalen; i++) {
7515 ret.data[i] = Event_clone(&orig->data[i]);
7519 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7522 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7523 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7524 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
7528 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7529 return TxOut_clone(&owner->b);
7531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7532 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7533 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7534 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7535 return (int64_t)ret_ref;
7538 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7539 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7540 for (size_t i = 0; i < ret.datalen; i++) {
7541 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7545 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7546 return ThirtyTwoBytes_clone(&owner->a);
7548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7549 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7550 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7551 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
7555 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7556 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7558 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7559 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7560 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7561 int64_tArray ret_arr = NULL;
7562 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7563 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7564 for (size_t u = 0; u < ret_var.datalen; u++) {
7565 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7566 *ret_conv_20_conv = ret_var.data[u];
7567 ret_arr_ptr[u] = ((int64_t)ret_conv_20_conv);
7569 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7574 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
7575 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 };
7576 for (size_t i = 0; i < ret.datalen; i++) {
7577 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7581 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
7582 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
7583 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
7584 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
7585 static jclass LDKBalance_ContentiousClaimable_class = NULL;
7586 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
7587 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
7588 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
7589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
7590 LDKBalance_ClaimableOnChannelClose_class =
7591 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
7592 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
7593 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
7594 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
7595 LDKBalance_ClaimableAwaitingConfirmations_class =
7596 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
7597 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
7598 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
7599 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
7600 LDKBalance_ContentiousClaimable_class =
7601 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
7602 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
7603 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
7604 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
7605 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
7606 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
7607 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
7608 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
7609 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
7611 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7612 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
7614 case LDKBalance_ClaimableOnChannelClose: {
7615 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
7617 case LDKBalance_ClaimableAwaitingConfirmations: {
7618 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
7620 case LDKBalance_ContentiousClaimable: {
7621 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
7623 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
7624 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);
7629 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7630 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7631 for (size_t i = 0; i < ret.datalen; i++) {
7632 ret.data[i] = Balance_clone(&orig->data[i]);
7636 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7637 CHECK(owner->result_ok);
7638 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
7640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7641 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7642 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7643 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7644 return ((int64_t)ret_conv);
7647 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7648 CHECK(!owner->result_ok);
7649 return DecodeError_clone(&*owner->contents.err);
7651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7652 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7653 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7654 int64_t ret_ref = 0;
7655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7658 ret_ref = (uintptr_t)ret_var.inner;
7659 if (ret_var.is_owned) {
7665 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7666 CHECK(owner->result_ok);
7667 return *owner->contents.result;
7669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7670 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7671 CResult_NoneLightningErrorZ_get_ok(owner_conv);
7674 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7675 CHECK(!owner->result_ok);
7676 return LightningError_clone(&*owner->contents.err);
7678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7679 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7680 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
7681 int64_t ret_ref = 0;
7682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7685 ret_ref = (uintptr_t)ret_var.inner;
7686 if (ret_var.is_owned) {
7692 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7696 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7697 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7698 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
7702 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7703 return Type_clone(&owner->b);
7705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7706 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7707 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7708 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7709 return (int64_t)ret_ret;
7712 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7713 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7714 for (size_t i = 0; i < ret.datalen; i++) {
7715 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7719 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7720 CHECK(owner->result_ok);
7721 return *owner->contents.result;
7723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7724 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7725 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
7729 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7730 CHECK(!owner->result_ok);
7731 return LightningError_clone(&*owner->contents.err);
7733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7734 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7735 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
7736 int64_t ret_ref = 0;
7737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7740 ret_ref = (uintptr_t)ret_var.inner;
7741 if (ret_var.is_owned) {
7747 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7748 return ChannelAnnouncement_clone(&owner->a);
7750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7751 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7752 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
7753 int64_t ret_ref = 0;
7754 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7755 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7757 ret_ref = (uintptr_t)ret_var.inner;
7758 if (ret_var.is_owned) {
7764 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7765 return ChannelUpdate_clone(&owner->b);
7767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7768 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7769 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
7770 int64_t ret_ref = 0;
7771 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7772 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7774 ret_ref = (uintptr_t)ret_var.inner;
7775 if (ret_var.is_owned) {
7781 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7782 return ChannelUpdate_clone(&owner->c);
7784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7785 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7786 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
7787 int64_t ret_ref = 0;
7788 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7789 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7791 ret_ref = (uintptr_t)ret_var.inner;
7792 if (ret_var.is_owned) {
7798 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
7799 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
7800 for (size_t i = 0; i < ret.datalen; i++) {
7801 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
7805 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
7806 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
7807 for (size_t i = 0; i < ret.datalen; i++) {
7808 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
7812 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
7813 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
7814 static jclass LDKCOption_NetAddressZ_None_class = NULL;
7815 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
7816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
7817 LDKCOption_NetAddressZ_Some_class =
7818 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
7819 CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
7820 LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
7821 CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
7822 LDKCOption_NetAddressZ_None_class =
7823 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
7824 CHECK(LDKCOption_NetAddressZ_None_class != NULL);
7825 LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
7826 CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
7828 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7829 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
7831 case LDKCOption_NetAddressZ_Some: {
7832 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
7833 return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
7835 case LDKCOption_NetAddressZ_None: {
7836 return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
7841 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7842 CHECK(owner->result_ok);
7843 return CVec_u8Z_clone(&*owner->contents.result);
7845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7846 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7847 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7848 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7849 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7850 CVec_u8Z_free(ret_var);
7854 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7855 CHECK(!owner->result_ok);
7856 return PeerHandleError_clone(&*owner->contents.err);
7858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7859 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7860 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7861 int64_t ret_ref = 0;
7862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7865 ret_ref = (uintptr_t)ret_var.inner;
7866 if (ret_var.is_owned) {
7872 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7873 CHECK(owner->result_ok);
7874 return *owner->contents.result;
7876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7877 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7878 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7881 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7882 CHECK(!owner->result_ok);
7883 return PeerHandleError_clone(&*owner->contents.err);
7885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7886 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7887 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7888 int64_t ret_ref = 0;
7889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7892 ret_ref = (uintptr_t)ret_var.inner;
7893 if (ret_var.is_owned) {
7899 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7900 CHECK(owner->result_ok);
7901 return *owner->contents.result;
7903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7904 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7905 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7909 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7910 CHECK(!owner->result_ok);
7911 return PeerHandleError_clone(&*owner->contents.err);
7913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7914 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7915 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7916 int64_t ret_ref = 0;
7917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7920 ret_ref = (uintptr_t)ret_var.inner;
7921 if (ret_var.is_owned) {
7927 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7928 CHECK(owner->result_ok);
7929 return NodeId_clone(&*owner->contents.result);
7931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7932 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7933 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
7934 int64_t ret_ref = 0;
7935 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7936 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7938 ret_ref = (uintptr_t)ret_var.inner;
7939 if (ret_var.is_owned) {
7945 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7946 CHECK(!owner->result_ok);
7947 return DecodeError_clone(&*owner->contents.err);
7949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7950 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7951 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
7952 int64_t ret_ref = 0;
7953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7956 ret_ref = (uintptr_t)ret_var.inner;
7957 if (ret_var.is_owned) {
7963 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7964 CHECK(owner->result_ok);
7965 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
7967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7968 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7969 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
7970 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
7971 int64_t ret_ref = (uintptr_t)ret_copy;
7975 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7976 CHECK(!owner->result_ok);
7977 return DecodeError_clone(&*owner->contents.err);
7979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7980 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7981 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
7982 int64_t ret_ref = 0;
7983 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7984 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7986 ret_ref = (uintptr_t)ret_var.inner;
7987 if (ret_var.is_owned) {
7993 typedef struct LDKAccess_JCalls {
7994 atomic_size_t refcnt;
7997 jmethodID get_utxo_meth;
7999 static void LDKAccess_JCalls_free(void* this_arg) {
8000 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
8001 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8003 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8004 if (get_jenv_res == JNI_EDETACHED) {
8005 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8007 DO_ASSERT(get_jenv_res == JNI_OK);
8009 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8010 if (get_jenv_res == JNI_EDETACHED) {
8011 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8016 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
8017 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
8019 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8020 if (get_jenv_res == JNI_EDETACHED) {
8021 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8023 DO_ASSERT(get_jenv_res == JNI_OK);
8025 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
8026 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
8027 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8029 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
8030 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8031 (*env)->ExceptionDescribe(env);
8032 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
8034 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8035 CHECK_ACCESS(ret_ptr);
8036 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
8038 if (get_jenv_res == JNI_EDETACHED) {
8039 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8043 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
8044 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
8045 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8047 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
8048 jclass c = (*env)->GetObjectClass(env, o);
8050 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
8051 atomic_init(&calls->refcnt, 1);
8052 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8053 calls->o = (*env)->NewWeakGlobalRef(env, o);
8054 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
8055 CHECK(calls->get_utxo_meth != NULL);
8058 .this_arg = (void*) calls,
8059 .get_utxo = get_utxo_LDKAccess_jcall,
8060 .free = LDKAccess_JCalls_free,
8064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
8065 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
8066 *res_ptr = LDKAccess_init(env, clz, o);
8067 return (uint64_t)res_ptr;
8069 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) {
8070 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8071 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8072 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
8073 unsigned char genesis_hash_arr[32];
8074 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
8075 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
8076 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
8077 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8078 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
8079 return (int64_t)ret_conv;
8082 static jclass LDKCOption_AccessZ_Some_class = NULL;
8083 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
8084 static jclass LDKCOption_AccessZ_None_class = NULL;
8085 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
8086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
8087 LDKCOption_AccessZ_Some_class =
8088 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
8089 CHECK(LDKCOption_AccessZ_Some_class != NULL);
8090 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
8091 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
8092 LDKCOption_AccessZ_None_class =
8093 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
8094 CHECK(LDKCOption_AccessZ_None_class != NULL);
8095 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
8096 CHECK(LDKCOption_AccessZ_None_meth != NULL);
8098 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8099 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
8101 case LDKCOption_AccessZ_Some: {
8102 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
8103 *some_ret = obj->some;
8104 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8105 if ((*some_ret).free == LDKAccess_JCalls_free) {
8106 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8107 LDKAccess_JCalls_cloned(&(*some_ret));
8109 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (int64_t)some_ret);
8111 case LDKCOption_AccessZ_None: {
8112 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
8117 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
8118 CHECK(owner->result_ok);
8119 return ChannelUpdateInfo_clone(&*owner->contents.result);
8121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8122 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
8123 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
8124 int64_t ret_ref = 0;
8125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8128 ret_ref = (uintptr_t)ret_var.inner;
8129 if (ret_var.is_owned) {
8135 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
8136 CHECK(!owner->result_ok);
8137 return DecodeError_clone(&*owner->contents.err);
8139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8140 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
8141 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
8142 int64_t ret_ref = 0;
8143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8146 ret_ref = (uintptr_t)ret_var.inner;
8147 if (ret_var.is_owned) {
8153 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
8154 CHECK(owner->result_ok);
8155 return ChannelInfo_clone(&*owner->contents.result);
8157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8158 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
8159 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
8160 int64_t ret_ref = 0;
8161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8164 ret_ref = (uintptr_t)ret_var.inner;
8165 if (ret_var.is_owned) {
8171 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
8172 CHECK(!owner->result_ok);
8173 return DecodeError_clone(&*owner->contents.err);
8175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8176 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
8177 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
8178 int64_t ret_ref = 0;
8179 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8180 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8182 ret_ref = (uintptr_t)ret_var.inner;
8183 if (ret_var.is_owned) {
8189 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
8190 CHECK(owner->result_ok);
8191 return RoutingFees_clone(&*owner->contents.result);
8193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8194 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
8195 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
8196 int64_t ret_ref = 0;
8197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8200 ret_ref = (uintptr_t)ret_var.inner;
8201 if (ret_var.is_owned) {
8207 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
8208 CHECK(!owner->result_ok);
8209 return DecodeError_clone(&*owner->contents.err);
8211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8212 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
8213 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
8214 int64_t ret_ref = 0;
8215 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8216 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8218 ret_ref = (uintptr_t)ret_var.inner;
8219 if (ret_var.is_owned) {
8225 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
8226 CHECK(owner->result_ok);
8227 return NodeAnnouncementInfo_clone(&*owner->contents.result);
8229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8230 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
8231 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
8232 int64_t ret_ref = 0;
8233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8236 ret_ref = (uintptr_t)ret_var.inner;
8237 if (ret_var.is_owned) {
8243 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
8244 CHECK(!owner->result_ok);
8245 return DecodeError_clone(&*owner->contents.err);
8247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8248 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
8249 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
8250 int64_t ret_ref = 0;
8251 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8252 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8254 ret_ref = (uintptr_t)ret_var.inner;
8255 if (ret_var.is_owned) {
8261 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
8262 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
8263 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
8266 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
8267 CHECK(owner->result_ok);
8268 return NodeInfo_clone(&*owner->contents.result);
8270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8271 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
8272 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
8273 int64_t ret_ref = 0;
8274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8277 ret_ref = (uintptr_t)ret_var.inner;
8278 if (ret_var.is_owned) {
8284 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
8285 CHECK(!owner->result_ok);
8286 return DecodeError_clone(&*owner->contents.err);
8288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8289 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
8290 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
8291 int64_t ret_ref = 0;
8292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8295 ret_ref = (uintptr_t)ret_var.inner;
8296 if (ret_var.is_owned) {
8302 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
8303 CHECK(owner->result_ok);
8304 return NetworkGraph_clone(&*owner->contents.result);
8306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8307 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
8308 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
8309 int64_t ret_ref = 0;
8310 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8311 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8313 ret_ref = (uintptr_t)ret_var.inner;
8314 if (ret_var.is_owned) {
8320 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
8321 CHECK(!owner->result_ok);
8322 return DecodeError_clone(&*owner->contents.err);
8324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8325 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
8326 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
8327 int64_t ret_ref = 0;
8328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8331 ret_ref = (uintptr_t)ret_var.inner;
8332 if (ret_var.is_owned) {
8338 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
8339 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
8340 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
8341 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
8342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
8343 LDKCOption_CVec_NetAddressZZ_Some_class =
8344 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
8345 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
8346 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
8347 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
8348 LDKCOption_CVec_NetAddressZZ_None_class =
8349 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
8350 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
8351 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
8352 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
8354 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8355 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
8357 case LDKCOption_CVec_NetAddressZZ_Some: {
8358 LDKCVec_NetAddressZ some_var = obj->some;
8359 int64_tArray some_arr = NULL;
8360 some_arr = (*env)->NewLongArray(env, some_var.datalen);
8361 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
8362 for (size_t m = 0; m < some_var.datalen; m++) {
8363 int64_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
8364 some_arr_ptr[m] = some_conv_12_ref;
8366 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
8367 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
8369 case LDKCOption_CVec_NetAddressZZ_None: {
8370 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
8375 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8376 CHECK(owner->result_ok);
8377 return NetAddress_clone(&*owner->contents.result);
8379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8380 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8381 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8382 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8383 int64_t ret_ref = (uintptr_t)ret_copy;
8387 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8388 CHECK(!owner->result_ok);
8389 return DecodeError_clone(&*owner->contents.err);
8391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8392 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8393 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8394 int64_t ret_ref = 0;
8395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8398 ret_ref = (uintptr_t)ret_var.inner;
8399 if (ret_var.is_owned) {
8405 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8406 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8407 for (size_t i = 0; i < ret.datalen; i++) {
8408 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8412 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8413 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8414 for (size_t i = 0; i < ret.datalen; i++) {
8415 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8419 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8420 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8421 for (size_t i = 0; i < ret.datalen; i++) {
8422 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8426 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8427 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8428 for (size_t i = 0; i < ret.datalen; i++) {
8429 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8433 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8434 CHECK(owner->result_ok);
8435 return AcceptChannel_clone(&*owner->contents.result);
8437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8438 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8439 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8440 int64_t ret_ref = 0;
8441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8444 ret_ref = (uintptr_t)ret_var.inner;
8445 if (ret_var.is_owned) {
8451 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8452 CHECK(!owner->result_ok);
8453 return DecodeError_clone(&*owner->contents.err);
8455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8456 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8457 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8458 int64_t ret_ref = 0;
8459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8462 ret_ref = (uintptr_t)ret_var.inner;
8463 if (ret_var.is_owned) {
8469 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8470 CHECK(owner->result_ok);
8471 return AnnouncementSignatures_clone(&*owner->contents.result);
8473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8474 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8475 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8476 int64_t ret_ref = 0;
8477 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8478 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8480 ret_ref = (uintptr_t)ret_var.inner;
8481 if (ret_var.is_owned) {
8487 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8488 CHECK(!owner->result_ok);
8489 return DecodeError_clone(&*owner->contents.err);
8491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8492 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8493 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8494 int64_t ret_ref = 0;
8495 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8496 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8498 ret_ref = (uintptr_t)ret_var.inner;
8499 if (ret_var.is_owned) {
8505 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8506 CHECK(owner->result_ok);
8507 return ChannelReestablish_clone(&*owner->contents.result);
8509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8510 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8511 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8512 int64_t ret_ref = 0;
8513 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8514 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8516 ret_ref = (uintptr_t)ret_var.inner;
8517 if (ret_var.is_owned) {
8523 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8524 CHECK(!owner->result_ok);
8525 return DecodeError_clone(&*owner->contents.err);
8527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8528 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8529 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8530 int64_t ret_ref = 0;
8531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8534 ret_ref = (uintptr_t)ret_var.inner;
8535 if (ret_var.is_owned) {
8541 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8542 CHECK(owner->result_ok);
8543 return ClosingSigned_clone(&*owner->contents.result);
8545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8546 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8547 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8548 int64_t ret_ref = 0;
8549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8552 ret_ref = (uintptr_t)ret_var.inner;
8553 if (ret_var.is_owned) {
8559 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8560 CHECK(!owner->result_ok);
8561 return DecodeError_clone(&*owner->contents.err);
8563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8564 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8565 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8566 int64_t ret_ref = 0;
8567 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8568 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8570 ret_ref = (uintptr_t)ret_var.inner;
8571 if (ret_var.is_owned) {
8577 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8578 CHECK(owner->result_ok);
8579 return ClosingSignedFeeRange_clone(&*owner->contents.result);
8581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8582 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8583 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8584 int64_t ret_ref = 0;
8585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8588 ret_ref = (uintptr_t)ret_var.inner;
8589 if (ret_var.is_owned) {
8595 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8596 CHECK(!owner->result_ok);
8597 return DecodeError_clone(&*owner->contents.err);
8599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8600 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8601 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8602 int64_t ret_ref = 0;
8603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8606 ret_ref = (uintptr_t)ret_var.inner;
8607 if (ret_var.is_owned) {
8613 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8614 CHECK(owner->result_ok);
8615 return CommitmentSigned_clone(&*owner->contents.result);
8617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8618 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8619 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8620 int64_t ret_ref = 0;
8621 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8622 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8624 ret_ref = (uintptr_t)ret_var.inner;
8625 if (ret_var.is_owned) {
8631 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8632 CHECK(!owner->result_ok);
8633 return DecodeError_clone(&*owner->contents.err);
8635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8636 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8637 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8638 int64_t ret_ref = 0;
8639 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8640 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8642 ret_ref = (uintptr_t)ret_var.inner;
8643 if (ret_var.is_owned) {
8649 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8650 CHECK(owner->result_ok);
8651 return FundingCreated_clone(&*owner->contents.result);
8653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8654 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8655 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8656 int64_t ret_ref = 0;
8657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8660 ret_ref = (uintptr_t)ret_var.inner;
8661 if (ret_var.is_owned) {
8667 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8668 CHECK(!owner->result_ok);
8669 return DecodeError_clone(&*owner->contents.err);
8671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8672 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8673 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8674 int64_t ret_ref = 0;
8675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8678 ret_ref = (uintptr_t)ret_var.inner;
8679 if (ret_var.is_owned) {
8685 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8686 CHECK(owner->result_ok);
8687 return FundingSigned_clone(&*owner->contents.result);
8689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8690 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8691 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8692 int64_t ret_ref = 0;
8693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8696 ret_ref = (uintptr_t)ret_var.inner;
8697 if (ret_var.is_owned) {
8703 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8704 CHECK(!owner->result_ok);
8705 return DecodeError_clone(&*owner->contents.err);
8707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8708 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8709 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8710 int64_t ret_ref = 0;
8711 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8712 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8714 ret_ref = (uintptr_t)ret_var.inner;
8715 if (ret_var.is_owned) {
8721 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
8722 CHECK(owner->result_ok);
8723 return FundingLocked_clone(&*owner->contents.result);
8725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8726 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8727 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
8728 int64_t ret_ref = 0;
8729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8732 ret_ref = (uintptr_t)ret_var.inner;
8733 if (ret_var.is_owned) {
8739 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
8740 CHECK(!owner->result_ok);
8741 return DecodeError_clone(&*owner->contents.err);
8743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8744 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8745 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
8746 int64_t ret_ref = 0;
8747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8750 ret_ref = (uintptr_t)ret_var.inner;
8751 if (ret_var.is_owned) {
8757 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8758 CHECK(owner->result_ok);
8759 return Init_clone(&*owner->contents.result);
8761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8762 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8763 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8764 int64_t ret_ref = 0;
8765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8768 ret_ref = (uintptr_t)ret_var.inner;
8769 if (ret_var.is_owned) {
8775 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8776 CHECK(!owner->result_ok);
8777 return DecodeError_clone(&*owner->contents.err);
8779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8780 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8781 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
8782 int64_t ret_ref = 0;
8783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8786 ret_ref = (uintptr_t)ret_var.inner;
8787 if (ret_var.is_owned) {
8793 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8794 CHECK(owner->result_ok);
8795 return OpenChannel_clone(&*owner->contents.result);
8797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8798 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8799 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8800 int64_t ret_ref = 0;
8801 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8802 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8804 ret_ref = (uintptr_t)ret_var.inner;
8805 if (ret_var.is_owned) {
8811 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8812 CHECK(!owner->result_ok);
8813 return DecodeError_clone(&*owner->contents.err);
8815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8816 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8817 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8818 int64_t ret_ref = 0;
8819 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8820 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8822 ret_ref = (uintptr_t)ret_var.inner;
8823 if (ret_var.is_owned) {
8829 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8830 CHECK(owner->result_ok);
8831 return RevokeAndACK_clone(&*owner->contents.result);
8833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8834 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8835 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8836 int64_t ret_ref = 0;
8837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8840 ret_ref = (uintptr_t)ret_var.inner;
8841 if (ret_var.is_owned) {
8847 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8848 CHECK(!owner->result_ok);
8849 return DecodeError_clone(&*owner->contents.err);
8851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8852 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8853 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8854 int64_t ret_ref = 0;
8855 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8856 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8858 ret_ref = (uintptr_t)ret_var.inner;
8859 if (ret_var.is_owned) {
8865 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8866 CHECK(owner->result_ok);
8867 return Shutdown_clone(&*owner->contents.result);
8869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8870 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8871 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8872 int64_t ret_ref = 0;
8873 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8874 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8876 ret_ref = (uintptr_t)ret_var.inner;
8877 if (ret_var.is_owned) {
8883 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8884 CHECK(!owner->result_ok);
8885 return DecodeError_clone(&*owner->contents.err);
8887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8888 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8889 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8890 int64_t ret_ref = 0;
8891 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8892 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8894 ret_ref = (uintptr_t)ret_var.inner;
8895 if (ret_var.is_owned) {
8901 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8902 CHECK(owner->result_ok);
8903 return UpdateFailHTLC_clone(&*owner->contents.result);
8905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8906 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8907 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8908 int64_t ret_ref = 0;
8909 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8910 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8912 ret_ref = (uintptr_t)ret_var.inner;
8913 if (ret_var.is_owned) {
8919 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8920 CHECK(!owner->result_ok);
8921 return DecodeError_clone(&*owner->contents.err);
8923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8924 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8925 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8926 int64_t ret_ref = 0;
8927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8930 ret_ref = (uintptr_t)ret_var.inner;
8931 if (ret_var.is_owned) {
8937 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8938 CHECK(owner->result_ok);
8939 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
8941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8942 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8943 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8944 int64_t ret_ref = 0;
8945 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8946 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8948 ret_ref = (uintptr_t)ret_var.inner;
8949 if (ret_var.is_owned) {
8955 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8956 CHECK(!owner->result_ok);
8957 return DecodeError_clone(&*owner->contents.err);
8959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8960 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8961 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8962 int64_t ret_ref = 0;
8963 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8964 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8966 ret_ref = (uintptr_t)ret_var.inner;
8967 if (ret_var.is_owned) {
8973 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8974 CHECK(owner->result_ok);
8975 return UpdateFee_clone(&*owner->contents.result);
8977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8978 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8979 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8980 int64_t ret_ref = 0;
8981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8984 ret_ref = (uintptr_t)ret_var.inner;
8985 if (ret_var.is_owned) {
8991 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8992 CHECK(!owner->result_ok);
8993 return DecodeError_clone(&*owner->contents.err);
8995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8996 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8997 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8998 int64_t ret_ref = 0;
8999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9002 ret_ref = (uintptr_t)ret_var.inner;
9003 if (ret_var.is_owned) {
9009 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9010 CHECK(owner->result_ok);
9011 return UpdateFulfillHTLC_clone(&*owner->contents.result);
9013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9014 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9015 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9016 int64_t ret_ref = 0;
9017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9020 ret_ref = (uintptr_t)ret_var.inner;
9021 if (ret_var.is_owned) {
9027 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9028 CHECK(!owner->result_ok);
9029 return DecodeError_clone(&*owner->contents.err);
9031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9032 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9033 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9034 int64_t ret_ref = 0;
9035 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9036 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9038 ret_ref = (uintptr_t)ret_var.inner;
9039 if (ret_var.is_owned) {
9045 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9046 CHECK(owner->result_ok);
9047 return UpdateAddHTLC_clone(&*owner->contents.result);
9049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9050 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9051 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9052 int64_t ret_ref = 0;
9053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9056 ret_ref = (uintptr_t)ret_var.inner;
9057 if (ret_var.is_owned) {
9063 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9064 CHECK(!owner->result_ok);
9065 return DecodeError_clone(&*owner->contents.err);
9067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9068 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9069 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9070 int64_t ret_ref = 0;
9071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9074 ret_ref = (uintptr_t)ret_var.inner;
9075 if (ret_var.is_owned) {
9081 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9082 CHECK(owner->result_ok);
9083 return Ping_clone(&*owner->contents.result);
9085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9086 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9087 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9088 int64_t ret_ref = 0;
9089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9092 ret_ref = (uintptr_t)ret_var.inner;
9093 if (ret_var.is_owned) {
9099 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9100 CHECK(!owner->result_ok);
9101 return DecodeError_clone(&*owner->contents.err);
9103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9104 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9105 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
9106 int64_t ret_ref = 0;
9107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9110 ret_ref = (uintptr_t)ret_var.inner;
9111 if (ret_var.is_owned) {
9117 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9118 CHECK(owner->result_ok);
9119 return Pong_clone(&*owner->contents.result);
9121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9122 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9123 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9124 int64_t ret_ref = 0;
9125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9128 ret_ref = (uintptr_t)ret_var.inner;
9129 if (ret_var.is_owned) {
9135 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9136 CHECK(!owner->result_ok);
9137 return DecodeError_clone(&*owner->contents.err);
9139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9140 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9141 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
9142 int64_t ret_ref = 0;
9143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9146 ret_ref = (uintptr_t)ret_var.inner;
9147 if (ret_var.is_owned) {
9153 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9154 CHECK(owner->result_ok);
9155 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
9157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9158 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9159 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9160 int64_t ret_ref = 0;
9161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9164 ret_ref = (uintptr_t)ret_var.inner;
9165 if (ret_var.is_owned) {
9171 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9172 CHECK(!owner->result_ok);
9173 return DecodeError_clone(&*owner->contents.err);
9175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9176 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9177 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9178 int64_t ret_ref = 0;
9179 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9180 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9182 ret_ref = (uintptr_t)ret_var.inner;
9183 if (ret_var.is_owned) {
9189 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9190 CHECK(owner->result_ok);
9191 return ChannelAnnouncement_clone(&*owner->contents.result);
9193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9194 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9195 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9196 int64_t ret_ref = 0;
9197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9200 ret_ref = (uintptr_t)ret_var.inner;
9201 if (ret_var.is_owned) {
9207 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9208 CHECK(!owner->result_ok);
9209 return DecodeError_clone(&*owner->contents.err);
9211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9212 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9213 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9214 int64_t ret_ref = 0;
9215 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9216 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9218 ret_ref = (uintptr_t)ret_var.inner;
9219 if (ret_var.is_owned) {
9225 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9226 CHECK(owner->result_ok);
9227 return UnsignedChannelUpdate_clone(&*owner->contents.result);
9229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9230 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9231 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9232 int64_t ret_ref = 0;
9233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9236 ret_ref = (uintptr_t)ret_var.inner;
9237 if (ret_var.is_owned) {
9243 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9244 CHECK(!owner->result_ok);
9245 return DecodeError_clone(&*owner->contents.err);
9247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9248 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9249 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9250 int64_t ret_ref = 0;
9251 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9252 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9254 ret_ref = (uintptr_t)ret_var.inner;
9255 if (ret_var.is_owned) {
9261 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9262 CHECK(owner->result_ok);
9263 return ChannelUpdate_clone(&*owner->contents.result);
9265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9266 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9267 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9268 int64_t ret_ref = 0;
9269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9272 ret_ref = (uintptr_t)ret_var.inner;
9273 if (ret_var.is_owned) {
9279 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9280 CHECK(!owner->result_ok);
9281 return DecodeError_clone(&*owner->contents.err);
9283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9284 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9285 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9286 int64_t ret_ref = 0;
9287 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9288 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9290 ret_ref = (uintptr_t)ret_var.inner;
9291 if (ret_var.is_owned) {
9297 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9298 CHECK(owner->result_ok);
9299 return ErrorMessage_clone(&*owner->contents.result);
9301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9302 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9303 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9304 int64_t ret_ref = 0;
9305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9308 ret_ref = (uintptr_t)ret_var.inner;
9309 if (ret_var.is_owned) {
9315 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9316 CHECK(!owner->result_ok);
9317 return DecodeError_clone(&*owner->contents.err);
9319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9320 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9321 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9322 int64_t ret_ref = 0;
9323 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9324 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9325 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9326 ret_ref = (uintptr_t)ret_var.inner;
9327 if (ret_var.is_owned) {
9333 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9334 CHECK(owner->result_ok);
9335 return WarningMessage_clone(&*owner->contents.result);
9337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9338 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9339 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9340 int64_t ret_ref = 0;
9341 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9342 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9344 ret_ref = (uintptr_t)ret_var.inner;
9345 if (ret_var.is_owned) {
9351 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9352 CHECK(!owner->result_ok);
9353 return DecodeError_clone(&*owner->contents.err);
9355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9356 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9357 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9358 int64_t ret_ref = 0;
9359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9362 ret_ref = (uintptr_t)ret_var.inner;
9363 if (ret_var.is_owned) {
9369 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9370 CHECK(owner->result_ok);
9371 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9374 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9375 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9376 int64_t ret_ref = 0;
9377 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9378 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9379 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9380 ret_ref = (uintptr_t)ret_var.inner;
9381 if (ret_var.is_owned) {
9387 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9388 CHECK(!owner->result_ok);
9389 return DecodeError_clone(&*owner->contents.err);
9391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9392 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9393 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9394 int64_t ret_ref = 0;
9395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9398 ret_ref = (uintptr_t)ret_var.inner;
9399 if (ret_var.is_owned) {
9405 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9406 CHECK(owner->result_ok);
9407 return NodeAnnouncement_clone(&*owner->contents.result);
9409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9410 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9411 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9412 int64_t ret_ref = 0;
9413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9416 ret_ref = (uintptr_t)ret_var.inner;
9417 if (ret_var.is_owned) {
9423 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9424 CHECK(!owner->result_ok);
9425 return DecodeError_clone(&*owner->contents.err);
9427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9428 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9429 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9430 int64_t ret_ref = 0;
9431 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9432 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9434 ret_ref = (uintptr_t)ret_var.inner;
9435 if (ret_var.is_owned) {
9441 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9442 CHECK(owner->result_ok);
9443 return QueryShortChannelIds_clone(&*owner->contents.result);
9445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9446 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9447 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9448 int64_t ret_ref = 0;
9449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9452 ret_ref = (uintptr_t)ret_var.inner;
9453 if (ret_var.is_owned) {
9459 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9460 CHECK(!owner->result_ok);
9461 return DecodeError_clone(&*owner->contents.err);
9463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9464 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9465 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9466 int64_t ret_ref = 0;
9467 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9468 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9470 ret_ref = (uintptr_t)ret_var.inner;
9471 if (ret_var.is_owned) {
9477 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9478 CHECK(owner->result_ok);
9479 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9482 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9483 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9484 int64_t ret_ref = 0;
9485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9488 ret_ref = (uintptr_t)ret_var.inner;
9489 if (ret_var.is_owned) {
9495 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9496 CHECK(!owner->result_ok);
9497 return DecodeError_clone(&*owner->contents.err);
9499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9500 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9501 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9502 int64_t ret_ref = 0;
9503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9506 ret_ref = (uintptr_t)ret_var.inner;
9507 if (ret_var.is_owned) {
9513 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9514 CHECK(owner->result_ok);
9515 return QueryChannelRange_clone(&*owner->contents.result);
9517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9518 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9519 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9520 int64_t ret_ref = 0;
9521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9524 ret_ref = (uintptr_t)ret_var.inner;
9525 if (ret_var.is_owned) {
9531 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9532 CHECK(!owner->result_ok);
9533 return DecodeError_clone(&*owner->contents.err);
9535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9536 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9537 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9538 int64_t ret_ref = 0;
9539 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9540 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9542 ret_ref = (uintptr_t)ret_var.inner;
9543 if (ret_var.is_owned) {
9549 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9550 CHECK(owner->result_ok);
9551 return ReplyChannelRange_clone(&*owner->contents.result);
9553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9554 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9555 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9556 int64_t ret_ref = 0;
9557 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9558 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9560 ret_ref = (uintptr_t)ret_var.inner;
9561 if (ret_var.is_owned) {
9567 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9568 CHECK(!owner->result_ok);
9569 return DecodeError_clone(&*owner->contents.err);
9571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9572 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9573 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9574 int64_t ret_ref = 0;
9575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9578 ret_ref = (uintptr_t)ret_var.inner;
9579 if (ret_var.is_owned) {
9585 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9586 CHECK(owner->result_ok);
9587 return GossipTimestampFilter_clone(&*owner->contents.result);
9589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9590 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9591 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9592 int64_t ret_ref = 0;
9593 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9594 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9596 ret_ref = (uintptr_t)ret_var.inner;
9597 if (ret_var.is_owned) {
9603 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9604 CHECK(!owner->result_ok);
9605 return DecodeError_clone(&*owner->contents.err);
9607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9608 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9609 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9610 int64_t ret_ref = 0;
9611 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9612 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9613 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9614 ret_ref = (uintptr_t)ret_var.inner;
9615 if (ret_var.is_owned) {
9621 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9622 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9623 for (size_t i = 0; i < ret.datalen; i++) {
9624 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9628 static jclass LDKSignOrCreationError_SignError_class = NULL;
9629 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9630 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9631 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9633 LDKSignOrCreationError_SignError_class =
9634 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9635 CHECK(LDKSignOrCreationError_SignError_class != NULL);
9636 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9637 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9638 LDKSignOrCreationError_CreationError_class =
9639 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9640 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9641 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9642 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9644 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9645 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
9647 case LDKSignOrCreationError_SignError: {
9648 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9650 case LDKSignOrCreationError_CreationError: {
9651 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9652 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9657 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9658 CHECK(owner->result_ok);
9659 return Invoice_clone(&*owner->contents.result);
9661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9662 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9663 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9664 int64_t ret_ref = 0;
9665 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9666 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9668 ret_ref = (uintptr_t)ret_var.inner;
9669 if (ret_var.is_owned) {
9675 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9676 CHECK(!owner->result_ok);
9677 return SignOrCreationError_clone(&*owner->contents.err);
9679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9680 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9681 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9682 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9683 int64_t ret_ref = (uintptr_t)ret_copy;
9687 typedef struct LDKFilter_JCalls {
9688 atomic_size_t refcnt;
9691 jmethodID register_tx_meth;
9692 jmethodID register_output_meth;
9694 static void LDKFilter_JCalls_free(void* this_arg) {
9695 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9696 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9698 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9699 if (get_jenv_res == JNI_EDETACHED) {
9700 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9702 DO_ASSERT(get_jenv_res == JNI_OK);
9704 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9705 if (get_jenv_res == JNI_EDETACHED) {
9706 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9711 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9712 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9714 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9715 if (get_jenv_res == JNI_EDETACHED) {
9716 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9718 DO_ASSERT(get_jenv_res == JNI_OK);
9720 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9721 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9722 LDKu8slice script_pubkey_var = script_pubkey;
9723 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9724 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9725 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9727 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9728 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9729 (*env)->ExceptionDescribe(env);
9730 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9732 if (get_jenv_res == JNI_EDETACHED) {
9733 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9736 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9737 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9739 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9740 if (get_jenv_res == JNI_EDETACHED) {
9741 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9743 DO_ASSERT(get_jenv_res == JNI_OK);
9745 LDKWatchedOutput output_var = output;
9746 int64_t output_ref = 0;
9747 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9748 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9749 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9750 output_ref = (uintptr_t)output_var.inner;
9751 if (output_var.is_owned) {
9754 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9756 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9757 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9758 (*env)->ExceptionDescribe(env);
9759 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9761 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9762 CHECK_ACCESS(ret_ptr);
9763 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9765 if (get_jenv_res == JNI_EDETACHED) {
9766 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9770 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9771 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9772 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9774 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9775 jclass c = (*env)->GetObjectClass(env, o);
9777 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9778 atomic_init(&calls->refcnt, 1);
9779 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9780 calls->o = (*env)->NewWeakGlobalRef(env, o);
9781 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9782 CHECK(calls->register_tx_meth != NULL);
9783 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9784 CHECK(calls->register_output_meth != NULL);
9787 .this_arg = (void*) calls,
9788 .register_tx = register_tx_LDKFilter_jcall,
9789 .register_output = register_output_LDKFilter_jcall,
9790 .free = LDKFilter_JCalls_free,
9794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9795 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9796 *res_ptr = LDKFilter_init(env, clz, o);
9797 return (uint64_t)res_ptr;
9799 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) {
9800 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9801 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9802 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9803 unsigned char txid_arr[32];
9804 CHECK((*env)->GetArrayLength(env, txid) == 32);
9805 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9806 unsigned char (*txid_ref)[32] = &txid_arr;
9807 LDKu8slice script_pubkey_ref;
9808 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9809 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9810 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9811 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9815 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9816 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9817 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9818 LDKWatchedOutput output_conv;
9819 output_conv.inner = (void*)(output & (~1));
9820 output_conv.is_owned = (output & 1) || (output == 0);
9821 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9822 output_conv = WatchedOutput_clone(&output_conv);
9823 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9824 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9825 int64_t ret_ref = (uintptr_t)ret_copy;
9829 static jclass LDKCOption_FilterZ_Some_class = NULL;
9830 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9831 static jclass LDKCOption_FilterZ_None_class = NULL;
9832 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9834 LDKCOption_FilterZ_Some_class =
9835 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9836 CHECK(LDKCOption_FilterZ_Some_class != NULL);
9837 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9838 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9839 LDKCOption_FilterZ_None_class =
9840 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9841 CHECK(LDKCOption_FilterZ_None_class != NULL);
9842 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9843 CHECK(LDKCOption_FilterZ_None_meth != NULL);
9845 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9846 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
9848 case LDKCOption_FilterZ_Some: {
9849 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9850 *some_ret = obj->some;
9851 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9852 if ((*some_ret).free == LDKFilter_JCalls_free) {
9853 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9854 LDKFilter_JCalls_cloned(&(*some_ret));
9856 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (int64_t)some_ret);
9858 case LDKCOption_FilterZ_None: {
9859 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9864 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9865 CHECK(owner->result_ok);
9866 return &*owner->contents.result;
9868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9869 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9870 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9871 int64_t ret_ref = 0;
9872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9875 ret_ref = (uintptr_t)ret_var.inner & ~1;
9879 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9880 CHECK(!owner->result_ok);
9881 return *owner->contents.err;
9883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9884 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9885 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9888 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9889 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9890 for (size_t i = 0; i < ret.datalen; i++) {
9891 ret.data[i] = OutPoint_clone(&orig->data[i]);
9895 typedef struct LDKMessageSendEventsProvider_JCalls {
9896 atomic_size_t refcnt;
9899 jmethodID get_and_clear_pending_msg_events_meth;
9900 } LDKMessageSendEventsProvider_JCalls;
9901 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9902 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9903 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9905 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9906 if (get_jenv_res == JNI_EDETACHED) {
9907 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9909 DO_ASSERT(get_jenv_res == JNI_OK);
9911 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9912 if (get_jenv_res == JNI_EDETACHED) {
9913 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9918 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9919 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9921 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9922 if (get_jenv_res == JNI_EDETACHED) {
9923 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9925 DO_ASSERT(get_jenv_res == JNI_OK);
9927 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9929 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9930 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9931 (*env)->ExceptionDescribe(env);
9932 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9934 LDKCVec_MessageSendEventZ ret_constr;
9935 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9936 if (ret_constr.datalen > 0)
9937 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9939 ret_constr.data = NULL;
9940 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9941 for (size_t s = 0; s < ret_constr.datalen; s++) {
9942 int64_t ret_conv_18 = ret_vals[s];
9943 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
9944 CHECK_ACCESS(ret_conv_18_ptr);
9945 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9946 FREE((void*)ret_conv_18);
9947 ret_constr.data[s] = ret_conv_18_conv;
9949 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9950 if (get_jenv_res == JNI_EDETACHED) {
9951 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9955 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
9956 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
9957 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9959 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9960 jclass c = (*env)->GetObjectClass(env, o);
9962 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
9963 atomic_init(&calls->refcnt, 1);
9964 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9965 calls->o = (*env)->NewWeakGlobalRef(env, o);
9966 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
9967 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
9969 LDKMessageSendEventsProvider ret = {
9970 .this_arg = (void*) calls,
9971 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
9972 .free = LDKMessageSendEventsProvider_JCalls_free,
9976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9977 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9978 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
9979 return (uint64_t)res_ptr;
9981 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9982 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9983 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9984 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
9985 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
9986 int64_tArray ret_arr = NULL;
9987 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9988 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9989 for (size_t s = 0; s < ret_var.datalen; s++) {
9990 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9991 *ret_conv_18_copy = ret_var.data[s];
9992 int64_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
9993 ret_arr_ptr[s] = ret_conv_18_ref;
9995 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10000 typedef struct LDKEventHandler_JCalls {
10001 atomic_size_t refcnt;
10004 jmethodID handle_event_meth;
10005 } LDKEventHandler_JCalls;
10006 static void LDKEventHandler_JCalls_free(void* this_arg) {
10007 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10008 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10010 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10011 if (get_jenv_res == JNI_EDETACHED) {
10012 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10014 DO_ASSERT(get_jenv_res == JNI_OK);
10016 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10017 if (get_jenv_res == JNI_EDETACHED) {
10018 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10023 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
10024 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10026 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10027 if (get_jenv_res == JNI_EDETACHED) {
10028 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10030 DO_ASSERT(get_jenv_res == JNI_OK);
10032 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
10033 *ret_event = Event_clone(event);
10034 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10035 CHECK(obj != NULL);
10036 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (int64_t)ret_event);
10037 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10038 (*env)->ExceptionDescribe(env);
10039 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
10041 if (get_jenv_res == JNI_EDETACHED) {
10042 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10045 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
10046 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
10047 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10049 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
10050 jclass c = (*env)->GetObjectClass(env, o);
10052 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
10053 atomic_init(&calls->refcnt, 1);
10054 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10055 calls->o = (*env)->NewWeakGlobalRef(env, o);
10056 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
10057 CHECK(calls->handle_event_meth != NULL);
10059 LDKEventHandler ret = {
10060 .this_arg = (void*) calls,
10061 .handle_event = handle_event_LDKEventHandler_jcall,
10062 .free = LDKEventHandler_JCalls_free,
10066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
10067 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10068 *res_ptr = LDKEventHandler_init(env, clz, o);
10069 return (uint64_t)res_ptr;
10071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
10072 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10073 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10074 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
10075 LDKEvent* event_conv = (LDKEvent*)event;
10076 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
10079 typedef struct LDKEventsProvider_JCalls {
10080 atomic_size_t refcnt;
10083 jmethodID process_pending_events_meth;
10084 } LDKEventsProvider_JCalls;
10085 static void LDKEventsProvider_JCalls_free(void* this_arg) {
10086 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10087 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10089 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10090 if (get_jenv_res == JNI_EDETACHED) {
10091 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10093 DO_ASSERT(get_jenv_res == JNI_OK);
10095 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10096 if (get_jenv_res == JNI_EDETACHED) {
10097 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10102 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
10103 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10105 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10106 if (get_jenv_res == JNI_EDETACHED) {
10107 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10109 DO_ASSERT(get_jenv_res == JNI_OK);
10111 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10112 *handler_ret = handler;
10113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10114 CHECK(obj != NULL);
10115 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (int64_t)handler_ret);
10116 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10117 (*env)->ExceptionDescribe(env);
10118 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
10120 if (get_jenv_res == JNI_EDETACHED) {
10121 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10124 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
10125 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
10126 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10128 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10129 jclass c = (*env)->GetObjectClass(env, o);
10131 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
10132 atomic_init(&calls->refcnt, 1);
10133 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10134 calls->o = (*env)->NewWeakGlobalRef(env, o);
10135 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
10136 CHECK(calls->process_pending_events_meth != NULL);
10138 LDKEventsProvider ret = {
10139 .this_arg = (void*) calls,
10140 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
10141 .free = LDKEventsProvider_JCalls_free,
10145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10146 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10147 *res_ptr = LDKEventsProvider_init(env, clz, o);
10148 return (uint64_t)res_ptr;
10150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
10151 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10152 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10153 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
10154 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
10155 CHECK_ACCESS(handler_ptr);
10156 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
10157 if (handler_conv.free == LDKEventHandler_JCalls_free) {
10158 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10159 LDKEventHandler_JCalls_cloned(&handler_conv);
10161 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
10164 typedef struct LDKListen_JCalls {
10165 atomic_size_t refcnt;
10168 jmethodID block_connected_meth;
10169 jmethodID block_disconnected_meth;
10170 } LDKListen_JCalls;
10171 static void LDKListen_JCalls_free(void* this_arg) {
10172 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10173 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10175 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10176 if (get_jenv_res == JNI_EDETACHED) {
10177 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10179 DO_ASSERT(get_jenv_res == JNI_OK);
10181 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10182 if (get_jenv_res == JNI_EDETACHED) {
10183 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10188 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
10189 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10191 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10192 if (get_jenv_res == JNI_EDETACHED) {
10193 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10195 DO_ASSERT(get_jenv_res == JNI_OK);
10197 LDKu8slice block_var = block;
10198 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
10199 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
10200 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10201 CHECK(obj != NULL);
10202 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
10203 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10204 (*env)->ExceptionDescribe(env);
10205 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
10207 if (get_jenv_res == JNI_EDETACHED) {
10208 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10211 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10212 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10214 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10215 if (get_jenv_res == JNI_EDETACHED) {
10216 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10218 DO_ASSERT(get_jenv_res == JNI_OK);
10220 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10221 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10222 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10223 CHECK(obj != NULL);
10224 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
10225 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10226 (*env)->ExceptionDescribe(env);
10227 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
10229 if (get_jenv_res == JNI_EDETACHED) {
10230 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10233 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
10234 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
10235 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10237 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
10238 jclass c = (*env)->GetObjectClass(env, o);
10240 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
10241 atomic_init(&calls->refcnt, 1);
10242 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10243 calls->o = (*env)->NewWeakGlobalRef(env, o);
10244 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
10245 CHECK(calls->block_connected_meth != NULL);
10246 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
10247 CHECK(calls->block_disconnected_meth != NULL);
10250 .this_arg = (void*) calls,
10251 .block_connected = block_connected_LDKListen_jcall,
10252 .block_disconnected = block_disconnected_LDKListen_jcall,
10253 .free = LDKListen_JCalls_free,
10257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
10258 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
10259 *res_ptr = LDKListen_init(env, clz, o);
10260 return (uint64_t)res_ptr;
10262 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) {
10263 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10264 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10265 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10266 LDKu8slice block_ref;
10267 block_ref.datalen = (*env)->GetArrayLength(env, block);
10268 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
10269 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
10270 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
10273 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) {
10274 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10275 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10276 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10277 unsigned char header_arr[80];
10278 CHECK((*env)->GetArrayLength(env, header) == 80);
10279 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10280 unsigned char (*header_ref)[80] = &header_arr;
10281 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
10284 typedef struct LDKConfirm_JCalls {
10285 atomic_size_t refcnt;
10288 jmethodID transactions_confirmed_meth;
10289 jmethodID transaction_unconfirmed_meth;
10290 jmethodID best_block_updated_meth;
10291 jmethodID get_relevant_txids_meth;
10292 } LDKConfirm_JCalls;
10293 static void LDKConfirm_JCalls_free(void* this_arg) {
10294 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10295 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10297 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10298 if (get_jenv_res == JNI_EDETACHED) {
10299 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10301 DO_ASSERT(get_jenv_res == JNI_OK);
10303 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10304 if (get_jenv_res == JNI_EDETACHED) {
10305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10310 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10311 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10313 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10314 if (get_jenv_res == JNI_EDETACHED) {
10315 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10317 DO_ASSERT(get_jenv_res == JNI_OK);
10319 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10320 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10321 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10322 int64_tArray txdata_arr = NULL;
10323 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10324 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10325 for (size_t c = 0; c < txdata_var.datalen; c++) {
10326 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10327 *txdata_conv_28_conv = txdata_var.data[c];
10328 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
10330 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10331 FREE(txdata_var.data);
10332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10333 CHECK(obj != NULL);
10334 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
10335 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10336 (*env)->ExceptionDescribe(env);
10337 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
10339 if (get_jenv_res == JNI_EDETACHED) {
10340 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10343 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
10344 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10346 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10347 if (get_jenv_res == JNI_EDETACHED) {
10348 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10350 DO_ASSERT(get_jenv_res == JNI_OK);
10352 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10353 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10354 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10355 CHECK(obj != NULL);
10356 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
10357 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10358 (*env)->ExceptionDescribe(env);
10359 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
10361 if (get_jenv_res == JNI_EDETACHED) {
10362 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10365 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10366 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10368 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10369 if (get_jenv_res == JNI_EDETACHED) {
10370 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10372 DO_ASSERT(get_jenv_res == JNI_OK);
10374 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10375 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10376 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10377 CHECK(obj != NULL);
10378 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
10379 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10380 (*env)->ExceptionDescribe(env);
10381 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
10383 if (get_jenv_res == JNI_EDETACHED) {
10384 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10387 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
10388 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10390 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10391 if (get_jenv_res == JNI_EDETACHED) {
10392 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10394 DO_ASSERT(get_jenv_res == JNI_OK);
10396 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10397 CHECK(obj != NULL);
10398 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
10399 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10400 (*env)->ExceptionDescribe(env);
10401 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
10403 LDKCVec_TxidZ ret_constr;
10404 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10405 if (ret_constr.datalen > 0)
10406 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10408 ret_constr.data = NULL;
10409 for (size_t i = 0; i < ret_constr.datalen; i++) {
10410 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
10411 LDKThirtyTwoBytes ret_conv_8_ref;
10412 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
10413 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
10414 ret_constr.data[i] = ret_conv_8_ref;
10416 if (get_jenv_res == JNI_EDETACHED) {
10417 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10421 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
10422 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
10423 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10425 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
10426 jclass c = (*env)->GetObjectClass(env, o);
10428 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
10429 atomic_init(&calls->refcnt, 1);
10430 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10431 calls->o = (*env)->NewWeakGlobalRef(env, o);
10432 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
10433 CHECK(calls->transactions_confirmed_meth != NULL);
10434 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
10435 CHECK(calls->transaction_unconfirmed_meth != NULL);
10436 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
10437 CHECK(calls->best_block_updated_meth != NULL);
10438 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
10439 CHECK(calls->get_relevant_txids_meth != NULL);
10442 .this_arg = (void*) calls,
10443 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
10444 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
10445 .best_block_updated = best_block_updated_LDKConfirm_jcall,
10446 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
10447 .free = LDKConfirm_JCalls_free,
10451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
10452 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
10453 *res_ptr = LDKConfirm_init(env, clz, o);
10454 return (uint64_t)res_ptr;
10456 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) {
10457 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10458 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10459 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10460 unsigned char header_arr[80];
10461 CHECK((*env)->GetArrayLength(env, header) == 80);
10462 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10463 unsigned char (*header_ref)[80] = &header_arr;
10464 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10465 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10466 if (txdata_constr.datalen > 0)
10467 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10469 txdata_constr.data = NULL;
10470 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10471 for (size_t c = 0; c < txdata_constr.datalen; c++) {
10472 int64_t txdata_conv_28 = txdata_vals[c];
10473 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
10474 CHECK_ACCESS(txdata_conv_28_ptr);
10475 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10476 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
10477 txdata_constr.data[c] = txdata_conv_28_conv;
10479 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10480 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
10484 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10485 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10486 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10487 unsigned char txid_arr[32];
10488 CHECK((*env)->GetArrayLength(env, txid) == 32);
10489 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10490 unsigned char (*txid_ref)[32] = &txid_arr;
10491 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
10494 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) {
10495 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10496 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10497 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10498 unsigned char header_arr[80];
10499 CHECK((*env)->GetArrayLength(env, header) == 80);
10500 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10501 unsigned char (*header_ref)[80] = &header_arr;
10502 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
10505 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
10506 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10507 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10508 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10509 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
10510 jobjectArray ret_arr = NULL;
10511 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10513 for (size_t i = 0; i < ret_var.datalen; i++) {
10514 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
10515 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
10516 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10519 FREE(ret_var.data);
10523 typedef struct LDKPersist_JCalls {
10524 atomic_size_t refcnt;
10527 jmethodID persist_new_channel_meth;
10528 jmethodID update_persisted_channel_meth;
10529 } LDKPersist_JCalls;
10530 static void LDKPersist_JCalls_free(void* this_arg) {
10531 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10532 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10534 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10535 if (get_jenv_res == JNI_EDETACHED) {
10536 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10538 DO_ASSERT(get_jenv_res == JNI_OK);
10540 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10541 if (get_jenv_res == JNI_EDETACHED) {
10542 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10547 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10548 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10550 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10551 if (get_jenv_res == JNI_EDETACHED) {
10552 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10554 DO_ASSERT(get_jenv_res == JNI_OK);
10556 LDKOutPoint channel_id_var = channel_id;
10557 int64_t channel_id_ref = 0;
10558 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10559 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10560 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10561 channel_id_ref = (uintptr_t)channel_id_var.inner;
10562 if (channel_id_var.is_owned) {
10563 channel_id_ref |= 1;
10565 LDKChannelMonitor data_var = *data;
10566 int64_t data_ref = 0;
10567 data_var = ChannelMonitor_clone(&data_var);
10568 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10569 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10570 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10571 data_ref = (uintptr_t)data_var.inner;
10572 if (data_var.is_owned) {
10575 LDKMonitorUpdateId update_id_var = update_id;
10576 int64_t update_id_ref = 0;
10577 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10578 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10579 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10580 update_id_ref = (uintptr_t)update_id_var.inner;
10581 if (update_id_var.is_owned) {
10582 update_id_ref |= 1;
10584 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10585 CHECK(obj != NULL);
10586 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
10587 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10588 (*env)->ExceptionDescribe(env);
10589 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
10591 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10592 CHECK_ACCESS(ret_ptr);
10593 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10595 if (get_jenv_res == JNI_EDETACHED) {
10596 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10600 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10601 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10603 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10604 if (get_jenv_res == JNI_EDETACHED) {
10605 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10607 DO_ASSERT(get_jenv_res == JNI_OK);
10609 LDKOutPoint channel_id_var = channel_id;
10610 int64_t channel_id_ref = 0;
10611 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10612 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10613 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10614 channel_id_ref = (uintptr_t)channel_id_var.inner;
10615 if (channel_id_var.is_owned) {
10616 channel_id_ref |= 1;
10618 LDKChannelMonitorUpdate update_var = *update;
10619 int64_t update_ref = 0;
10620 if ((uintptr_t)update_var.inner > 4096) {
10621 update_var = ChannelMonitorUpdate_clone(&update_var);
10622 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10623 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10624 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
10625 update_ref = (uintptr_t)update_var.inner;
10626 if (update_var.is_owned) {
10630 LDKChannelMonitor data_var = *data;
10631 int64_t data_ref = 0;
10632 data_var = ChannelMonitor_clone(&data_var);
10633 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10634 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10635 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10636 data_ref = (uintptr_t)data_var.inner;
10637 if (data_var.is_owned) {
10640 LDKMonitorUpdateId update_id_var = update_id;
10641 int64_t update_id_ref = 0;
10642 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10643 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10644 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10645 update_id_ref = (uintptr_t)update_id_var.inner;
10646 if (update_id_var.is_owned) {
10647 update_id_ref |= 1;
10649 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10650 CHECK(obj != NULL);
10651 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
10652 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10653 (*env)->ExceptionDescribe(env);
10654 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
10656 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10657 CHECK_ACCESS(ret_ptr);
10658 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10660 if (get_jenv_res == JNI_EDETACHED) {
10661 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10665 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
10666 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
10667 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10669 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
10670 jclass c = (*env)->GetObjectClass(env, o);
10672 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
10673 atomic_init(&calls->refcnt, 1);
10674 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10675 calls->o = (*env)->NewWeakGlobalRef(env, o);
10676 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
10677 CHECK(calls->persist_new_channel_meth != NULL);
10678 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
10679 CHECK(calls->update_persisted_channel_meth != NULL);
10682 .this_arg = (void*) calls,
10683 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
10684 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
10685 .free = LDKPersist_JCalls_free,
10689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
10690 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
10691 *res_ptr = LDKPersist_init(env, clz, o);
10692 return (uint64_t)res_ptr;
10694 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) {
10695 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10696 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10697 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10698 LDKOutPoint channel_id_conv;
10699 channel_id_conv.inner = (void*)(channel_id & (~1));
10700 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10701 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10702 channel_id_conv = OutPoint_clone(&channel_id_conv);
10703 LDKChannelMonitor data_conv;
10704 data_conv.inner = (void*)(data & (~1));
10705 data_conv.is_owned = false;
10706 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10707 LDKMonitorUpdateId update_id_conv;
10708 update_id_conv.inner = (void*)(update_id & (~1));
10709 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10710 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10711 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10712 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10713 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
10714 return (int64_t)ret_conv;
10717 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) {
10718 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10719 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10720 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10721 LDKOutPoint channel_id_conv;
10722 channel_id_conv.inner = (void*)(channel_id & (~1));
10723 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10724 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10725 channel_id_conv = OutPoint_clone(&channel_id_conv);
10726 LDKChannelMonitorUpdate update_conv;
10727 update_conv.inner = (void*)(update & (~1));
10728 update_conv.is_owned = false;
10729 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
10730 LDKChannelMonitor data_conv;
10731 data_conv.inner = (void*)(data & (~1));
10732 data_conv.is_owned = false;
10733 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10734 LDKMonitorUpdateId update_id_conv;
10735 update_id_conv.inner = (void*)(update_id & (~1));
10736 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10737 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10738 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10739 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10740 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
10741 return (int64_t)ret_conv;
10744 typedef struct LDKChannelMessageHandler_JCalls {
10745 atomic_size_t refcnt;
10748 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10749 jmethodID handle_open_channel_meth;
10750 jmethodID handle_accept_channel_meth;
10751 jmethodID handle_funding_created_meth;
10752 jmethodID handle_funding_signed_meth;
10753 jmethodID handle_funding_locked_meth;
10754 jmethodID handle_shutdown_meth;
10755 jmethodID handle_closing_signed_meth;
10756 jmethodID handle_update_add_htlc_meth;
10757 jmethodID handle_update_fulfill_htlc_meth;
10758 jmethodID handle_update_fail_htlc_meth;
10759 jmethodID handle_update_fail_malformed_htlc_meth;
10760 jmethodID handle_commitment_signed_meth;
10761 jmethodID handle_revoke_and_ack_meth;
10762 jmethodID handle_update_fee_meth;
10763 jmethodID handle_announcement_signatures_meth;
10764 jmethodID peer_disconnected_meth;
10765 jmethodID peer_connected_meth;
10766 jmethodID handle_channel_reestablish_meth;
10767 jmethodID handle_channel_update_meth;
10768 jmethodID handle_error_meth;
10769 } LDKChannelMessageHandler_JCalls;
10770 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10771 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10772 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10774 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10775 if (get_jenv_res == JNI_EDETACHED) {
10776 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10778 DO_ASSERT(get_jenv_res == JNI_OK);
10780 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10781 if (get_jenv_res == JNI_EDETACHED) {
10782 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10787 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
10788 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10790 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10791 if (get_jenv_res == JNI_EDETACHED) {
10792 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10794 DO_ASSERT(get_jenv_res == JNI_OK);
10796 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10797 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10798 LDKInitFeatures their_features_var = their_features;
10799 int64_t their_features_ref = 0;
10800 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10801 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10802 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10803 their_features_ref = (uintptr_t)their_features_var.inner;
10804 if (their_features_var.is_owned) {
10805 their_features_ref |= 1;
10807 LDKOpenChannel msg_var = *msg;
10808 int64_t msg_ref = 0;
10809 msg_var = OpenChannel_clone(&msg_var);
10810 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10811 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10812 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10813 msg_ref = (uintptr_t)msg_var.inner;
10814 if (msg_var.is_owned) {
10817 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10818 CHECK(obj != NULL);
10819 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10820 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10821 (*env)->ExceptionDescribe(env);
10822 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
10824 if (get_jenv_res == JNI_EDETACHED) {
10825 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10828 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
10829 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10831 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10832 if (get_jenv_res == JNI_EDETACHED) {
10833 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10835 DO_ASSERT(get_jenv_res == JNI_OK);
10837 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10838 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10839 LDKInitFeatures their_features_var = their_features;
10840 int64_t their_features_ref = 0;
10841 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10842 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10843 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10844 their_features_ref = (uintptr_t)their_features_var.inner;
10845 if (their_features_var.is_owned) {
10846 their_features_ref |= 1;
10848 LDKAcceptChannel msg_var = *msg;
10849 int64_t msg_ref = 0;
10850 msg_var = AcceptChannel_clone(&msg_var);
10851 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10852 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10853 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10854 msg_ref = (uintptr_t)msg_var.inner;
10855 if (msg_var.is_owned) {
10858 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10859 CHECK(obj != NULL);
10860 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10861 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10862 (*env)->ExceptionDescribe(env);
10863 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
10865 if (get_jenv_res == JNI_EDETACHED) {
10866 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10869 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10870 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10872 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10873 if (get_jenv_res == JNI_EDETACHED) {
10874 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10876 DO_ASSERT(get_jenv_res == JNI_OK);
10878 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10879 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10880 LDKFundingCreated msg_var = *msg;
10881 int64_t msg_ref = 0;
10882 msg_var = FundingCreated_clone(&msg_var);
10883 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10884 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10885 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10886 msg_ref = (uintptr_t)msg_var.inner;
10887 if (msg_var.is_owned) {
10890 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10891 CHECK(obj != NULL);
10892 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
10893 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10894 (*env)->ExceptionDescribe(env);
10895 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
10897 if (get_jenv_res == JNI_EDETACHED) {
10898 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10901 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
10902 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10904 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10905 if (get_jenv_res == JNI_EDETACHED) {
10906 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10908 DO_ASSERT(get_jenv_res == JNI_OK);
10910 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10911 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10912 LDKFundingSigned msg_var = *msg;
10913 int64_t msg_ref = 0;
10914 msg_var = FundingSigned_clone(&msg_var);
10915 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10916 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10917 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10918 msg_ref = (uintptr_t)msg_var.inner;
10919 if (msg_var.is_owned) {
10922 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10923 CHECK(obj != NULL);
10924 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
10925 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10926 (*env)->ExceptionDescribe(env);
10927 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
10929 if (get_jenv_res == JNI_EDETACHED) {
10930 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10933 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
10934 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10936 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10937 if (get_jenv_res == JNI_EDETACHED) {
10938 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10940 DO_ASSERT(get_jenv_res == JNI_OK);
10942 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10943 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10944 LDKFundingLocked msg_var = *msg;
10945 int64_t msg_ref = 0;
10946 msg_var = FundingLocked_clone(&msg_var);
10947 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10948 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10949 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10950 msg_ref = (uintptr_t)msg_var.inner;
10951 if (msg_var.is_owned) {
10954 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10955 CHECK(obj != NULL);
10956 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
10957 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10958 (*env)->ExceptionDescribe(env);
10959 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
10961 if (get_jenv_res == JNI_EDETACHED) {
10962 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10965 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
10966 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10968 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10969 if (get_jenv_res == JNI_EDETACHED) {
10970 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10972 DO_ASSERT(get_jenv_res == JNI_OK);
10974 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10975 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10976 LDKInitFeatures their_features_var = *their_features;
10977 int64_t their_features_ref = 0;
10978 their_features_var = InitFeatures_clone(&their_features_var);
10979 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10980 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10981 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10982 their_features_ref = (uintptr_t)their_features_var.inner;
10983 if (their_features_var.is_owned) {
10984 their_features_ref |= 1;
10986 LDKShutdown msg_var = *msg;
10987 int64_t msg_ref = 0;
10988 msg_var = Shutdown_clone(&msg_var);
10989 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10990 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10991 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10992 msg_ref = (uintptr_t)msg_var.inner;
10993 if (msg_var.is_owned) {
10996 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10997 CHECK(obj != NULL);
10998 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
10999 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11000 (*env)->ExceptionDescribe(env);
11001 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
11003 if (get_jenv_res == JNI_EDETACHED) {
11004 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11007 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11008 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11010 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11011 if (get_jenv_res == JNI_EDETACHED) {
11012 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11014 DO_ASSERT(get_jenv_res == JNI_OK);
11016 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11017 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11018 LDKClosingSigned msg_var = *msg;
11019 int64_t msg_ref = 0;
11020 msg_var = ClosingSigned_clone(&msg_var);
11021 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11022 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11023 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11024 msg_ref = (uintptr_t)msg_var.inner;
11025 if (msg_var.is_owned) {
11028 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11029 CHECK(obj != NULL);
11030 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
11031 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11032 (*env)->ExceptionDescribe(env);
11033 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
11035 if (get_jenv_res == JNI_EDETACHED) {
11036 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11039 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11040 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11042 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11043 if (get_jenv_res == JNI_EDETACHED) {
11044 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11046 DO_ASSERT(get_jenv_res == JNI_OK);
11048 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11049 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11050 LDKUpdateAddHTLC msg_var = *msg;
11051 int64_t msg_ref = 0;
11052 msg_var = UpdateAddHTLC_clone(&msg_var);
11053 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11054 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11055 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11056 msg_ref = (uintptr_t)msg_var.inner;
11057 if (msg_var.is_owned) {
11060 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11061 CHECK(obj != NULL);
11062 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11063 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11064 (*env)->ExceptionDescribe(env);
11065 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11067 if (get_jenv_res == JNI_EDETACHED) {
11068 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11071 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11072 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11074 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11075 if (get_jenv_res == JNI_EDETACHED) {
11076 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11078 DO_ASSERT(get_jenv_res == JNI_OK);
11080 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11081 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11082 LDKUpdateFulfillHTLC msg_var = *msg;
11083 int64_t msg_ref = 0;
11084 msg_var = UpdateFulfillHTLC_clone(&msg_var);
11085 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11086 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11087 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11088 msg_ref = (uintptr_t)msg_var.inner;
11089 if (msg_var.is_owned) {
11092 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11093 CHECK(obj != NULL);
11094 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11095 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11096 (*env)->ExceptionDescribe(env);
11097 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11099 if (get_jenv_res == JNI_EDETACHED) {
11100 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11103 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11104 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11106 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11107 if (get_jenv_res == JNI_EDETACHED) {
11108 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11110 DO_ASSERT(get_jenv_res == JNI_OK);
11112 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11113 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11114 LDKUpdateFailHTLC msg_var = *msg;
11115 int64_t msg_ref = 0;
11116 msg_var = UpdateFailHTLC_clone(&msg_var);
11117 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11118 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11119 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11120 msg_ref = (uintptr_t)msg_var.inner;
11121 if (msg_var.is_owned) {
11124 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11125 CHECK(obj != NULL);
11126 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11127 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11128 (*env)->ExceptionDescribe(env);
11129 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11131 if (get_jenv_res == JNI_EDETACHED) {
11132 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11135 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11136 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11138 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11139 if (get_jenv_res == JNI_EDETACHED) {
11140 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11142 DO_ASSERT(get_jenv_res == JNI_OK);
11144 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11145 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11146 LDKUpdateFailMalformedHTLC msg_var = *msg;
11147 int64_t msg_ref = 0;
11148 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11149 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11150 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11151 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11152 msg_ref = (uintptr_t)msg_var.inner;
11153 if (msg_var.is_owned) {
11156 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11157 CHECK(obj != NULL);
11158 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
11159 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11160 (*env)->ExceptionDescribe(env);
11161 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
11163 if (get_jenv_res == JNI_EDETACHED) {
11164 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11167 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11168 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11170 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11171 if (get_jenv_res == JNI_EDETACHED) {
11172 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11174 DO_ASSERT(get_jenv_res == JNI_OK);
11176 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11177 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11178 LDKCommitmentSigned msg_var = *msg;
11179 int64_t msg_ref = 0;
11180 msg_var = CommitmentSigned_clone(&msg_var);
11181 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11182 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11183 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11184 msg_ref = (uintptr_t)msg_var.inner;
11185 if (msg_var.is_owned) {
11188 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11189 CHECK(obj != NULL);
11190 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
11191 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11192 (*env)->ExceptionDescribe(env);
11193 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
11195 if (get_jenv_res == JNI_EDETACHED) {
11196 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11199 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11200 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11202 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11203 if (get_jenv_res == JNI_EDETACHED) {
11204 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11206 DO_ASSERT(get_jenv_res == JNI_OK);
11208 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11209 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11210 LDKRevokeAndACK msg_var = *msg;
11211 int64_t msg_ref = 0;
11212 msg_var = RevokeAndACK_clone(&msg_var);
11213 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11214 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11215 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11216 msg_ref = (uintptr_t)msg_var.inner;
11217 if (msg_var.is_owned) {
11220 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11221 CHECK(obj != NULL);
11222 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
11223 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11224 (*env)->ExceptionDescribe(env);
11225 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
11227 if (get_jenv_res == JNI_EDETACHED) {
11228 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11231 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11232 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11234 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11235 if (get_jenv_res == JNI_EDETACHED) {
11236 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11238 DO_ASSERT(get_jenv_res == JNI_OK);
11240 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11241 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11242 LDKUpdateFee msg_var = *msg;
11243 int64_t msg_ref = 0;
11244 msg_var = UpdateFee_clone(&msg_var);
11245 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11246 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11247 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11248 msg_ref = (uintptr_t)msg_var.inner;
11249 if (msg_var.is_owned) {
11252 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11253 CHECK(obj != NULL);
11254 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
11255 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11256 (*env)->ExceptionDescribe(env);
11257 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
11259 if (get_jenv_res == JNI_EDETACHED) {
11260 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11263 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11264 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11266 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11267 if (get_jenv_res == JNI_EDETACHED) {
11268 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11270 DO_ASSERT(get_jenv_res == JNI_OK);
11272 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11273 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11274 LDKAnnouncementSignatures msg_var = *msg;
11275 int64_t msg_ref = 0;
11276 msg_var = AnnouncementSignatures_clone(&msg_var);
11277 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11278 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11279 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11280 msg_ref = (uintptr_t)msg_var.inner;
11281 if (msg_var.is_owned) {
11284 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11285 CHECK(obj != NULL);
11286 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
11287 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11288 (*env)->ExceptionDescribe(env);
11289 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
11291 if (get_jenv_res == JNI_EDETACHED) {
11292 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11295 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
11296 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11298 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11299 if (get_jenv_res == JNI_EDETACHED) {
11300 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11302 DO_ASSERT(get_jenv_res == JNI_OK);
11304 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11305 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11306 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11307 CHECK(obj != NULL);
11308 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
11309 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11310 (*env)->ExceptionDescribe(env);
11311 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
11313 if (get_jenv_res == JNI_EDETACHED) {
11314 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11317 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
11318 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11320 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11321 if (get_jenv_res == JNI_EDETACHED) {
11322 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11324 DO_ASSERT(get_jenv_res == JNI_OK);
11326 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11327 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11328 LDKInit msg_var = *msg;
11329 int64_t msg_ref = 0;
11330 msg_var = Init_clone(&msg_var);
11331 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11332 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11333 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11334 msg_ref = (uintptr_t)msg_var.inner;
11335 if (msg_var.is_owned) {
11338 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11339 CHECK(obj != NULL);
11340 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
11341 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11342 (*env)->ExceptionDescribe(env);
11343 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
11345 if (get_jenv_res == JNI_EDETACHED) {
11346 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11349 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
11350 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11352 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11353 if (get_jenv_res == JNI_EDETACHED) {
11354 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11356 DO_ASSERT(get_jenv_res == JNI_OK);
11358 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11359 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11360 LDKChannelReestablish msg_var = *msg;
11361 int64_t msg_ref = 0;
11362 msg_var = ChannelReestablish_clone(&msg_var);
11363 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11364 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11365 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11366 msg_ref = (uintptr_t)msg_var.inner;
11367 if (msg_var.is_owned) {
11370 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11371 CHECK(obj != NULL);
11372 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
11373 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11374 (*env)->ExceptionDescribe(env);
11375 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
11377 if (get_jenv_res == JNI_EDETACHED) {
11378 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11381 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11382 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11384 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11385 if (get_jenv_res == JNI_EDETACHED) {
11386 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11388 DO_ASSERT(get_jenv_res == JNI_OK);
11390 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11391 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11392 LDKChannelUpdate msg_var = *msg;
11393 int64_t msg_ref = 0;
11394 msg_var = ChannelUpdate_clone(&msg_var);
11395 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11396 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11397 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11398 msg_ref = (uintptr_t)msg_var.inner;
11399 if (msg_var.is_owned) {
11402 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11403 CHECK(obj != NULL);
11404 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
11405 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11406 (*env)->ExceptionDescribe(env);
11407 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
11409 if (get_jenv_res == JNI_EDETACHED) {
11410 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11413 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11414 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11416 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11417 if (get_jenv_res == JNI_EDETACHED) {
11418 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11420 DO_ASSERT(get_jenv_res == JNI_OK);
11422 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11423 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11424 LDKErrorMessage msg_var = *msg;
11425 int64_t msg_ref = 0;
11426 msg_var = ErrorMessage_clone(&msg_var);
11427 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11428 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11429 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11430 msg_ref = (uintptr_t)msg_var.inner;
11431 if (msg_var.is_owned) {
11434 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11435 CHECK(obj != NULL);
11436 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
11437 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11438 (*env)->ExceptionDescribe(env);
11439 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
11441 if (get_jenv_res == JNI_EDETACHED) {
11442 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11445 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11446 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11447 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11448 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11450 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11451 jclass c = (*env)->GetObjectClass(env, o);
11453 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11454 atomic_init(&calls->refcnt, 1);
11455 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11456 calls->o = (*env)->NewWeakGlobalRef(env, o);
11457 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
11458 CHECK(calls->handle_open_channel_meth != NULL);
11459 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
11460 CHECK(calls->handle_accept_channel_meth != NULL);
11461 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
11462 CHECK(calls->handle_funding_created_meth != NULL);
11463 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
11464 CHECK(calls->handle_funding_signed_meth != NULL);
11465 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
11466 CHECK(calls->handle_funding_locked_meth != NULL);
11467 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
11468 CHECK(calls->handle_shutdown_meth != NULL);
11469 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
11470 CHECK(calls->handle_closing_signed_meth != NULL);
11471 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
11472 CHECK(calls->handle_update_add_htlc_meth != NULL);
11473 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
11474 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
11475 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
11476 CHECK(calls->handle_update_fail_htlc_meth != NULL);
11477 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
11478 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
11479 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
11480 CHECK(calls->handle_commitment_signed_meth != NULL);
11481 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
11482 CHECK(calls->handle_revoke_and_ack_meth != NULL);
11483 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
11484 CHECK(calls->handle_update_fee_meth != NULL);
11485 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
11486 CHECK(calls->handle_announcement_signatures_meth != NULL);
11487 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
11488 CHECK(calls->peer_disconnected_meth != NULL);
11489 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
11490 CHECK(calls->peer_connected_meth != NULL);
11491 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
11492 CHECK(calls->handle_channel_reestablish_meth != NULL);
11493 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
11494 CHECK(calls->handle_channel_update_meth != NULL);
11495 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
11496 CHECK(calls->handle_error_meth != NULL);
11498 LDKChannelMessageHandler ret = {
11499 .this_arg = (void*) calls,
11500 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11501 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11502 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
11503 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
11504 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
11505 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
11506 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
11507 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
11508 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
11509 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
11510 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
11511 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
11512 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
11513 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
11514 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
11515 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
11516 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
11517 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
11518 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
11519 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
11520 .free = LDKChannelMessageHandler_JCalls_free,
11521 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11523 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11527 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11528 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11529 return (uint64_t)res_ptr;
11531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11532 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
11533 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
11534 DO_ASSERT((res_ptr & 1) == 0);
11535 return (int64_t)(res_ptr | 1);
11537 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) {
11538 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11539 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11540 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11541 LDKPublicKey their_node_id_ref;
11542 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11543 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11544 LDKInitFeatures their_features_conv;
11545 their_features_conv.inner = (void*)(their_features & (~1));
11546 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11547 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11548 their_features_conv = InitFeatures_clone(&their_features_conv);
11549 LDKOpenChannel msg_conv;
11550 msg_conv.inner = (void*)(msg & (~1));
11551 msg_conv.is_owned = false;
11552 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11553 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11556 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) {
11557 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11558 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11559 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11560 LDKPublicKey their_node_id_ref;
11561 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11562 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11563 LDKInitFeatures their_features_conv;
11564 their_features_conv.inner = (void*)(their_features & (~1));
11565 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11566 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11567 their_features_conv = InitFeatures_clone(&their_features_conv);
11568 LDKAcceptChannel msg_conv;
11569 msg_conv.inner = (void*)(msg & (~1));
11570 msg_conv.is_owned = false;
11571 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11572 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11575 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) {
11576 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11577 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11578 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11579 LDKPublicKey their_node_id_ref;
11580 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11581 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11582 LDKFundingCreated msg_conv;
11583 msg_conv.inner = (void*)(msg & (~1));
11584 msg_conv.is_owned = false;
11585 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11586 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11589 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) {
11590 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11591 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11592 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11593 LDKPublicKey their_node_id_ref;
11594 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11595 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11596 LDKFundingSigned msg_conv;
11597 msg_conv.inner = (void*)(msg & (~1));
11598 msg_conv.is_owned = false;
11599 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11600 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11603 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) {
11604 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11605 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11606 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11607 LDKPublicKey their_node_id_ref;
11608 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11609 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11610 LDKFundingLocked msg_conv;
11611 msg_conv.inner = (void*)(msg & (~1));
11612 msg_conv.is_owned = false;
11613 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11614 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11617 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) {
11618 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11619 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11620 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11621 LDKPublicKey their_node_id_ref;
11622 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11623 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11624 LDKInitFeatures their_features_conv;
11625 their_features_conv.inner = (void*)(their_features & (~1));
11626 their_features_conv.is_owned = false;
11627 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11628 LDKShutdown msg_conv;
11629 msg_conv.inner = (void*)(msg & (~1));
11630 msg_conv.is_owned = false;
11631 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11632 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
11635 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) {
11636 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11637 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11638 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11639 LDKPublicKey their_node_id_ref;
11640 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11641 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11642 LDKClosingSigned msg_conv;
11643 msg_conv.inner = (void*)(msg & (~1));
11644 msg_conv.is_owned = false;
11645 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11646 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11649 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) {
11650 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11651 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11652 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11653 LDKPublicKey their_node_id_ref;
11654 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11655 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11656 LDKUpdateAddHTLC msg_conv;
11657 msg_conv.inner = (void*)(msg & (~1));
11658 msg_conv.is_owned = false;
11659 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11660 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11663 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) {
11664 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11665 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11666 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11667 LDKPublicKey their_node_id_ref;
11668 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11669 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11670 LDKUpdateFulfillHTLC msg_conv;
11671 msg_conv.inner = (void*)(msg & (~1));
11672 msg_conv.is_owned = false;
11673 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11674 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11677 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) {
11678 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11679 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11680 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11681 LDKPublicKey their_node_id_ref;
11682 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11683 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11684 LDKUpdateFailHTLC msg_conv;
11685 msg_conv.inner = (void*)(msg & (~1));
11686 msg_conv.is_owned = false;
11687 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11688 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11691 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) {
11692 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11693 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11694 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11695 LDKPublicKey their_node_id_ref;
11696 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11697 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11698 LDKUpdateFailMalformedHTLC msg_conv;
11699 msg_conv.inner = (void*)(msg & (~1));
11700 msg_conv.is_owned = false;
11701 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11702 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11705 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) {
11706 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11707 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11708 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11709 LDKPublicKey their_node_id_ref;
11710 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11711 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11712 LDKCommitmentSigned msg_conv;
11713 msg_conv.inner = (void*)(msg & (~1));
11714 msg_conv.is_owned = false;
11715 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11716 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11719 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) {
11720 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11721 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11722 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11723 LDKPublicKey their_node_id_ref;
11724 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11725 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11726 LDKRevokeAndACK msg_conv;
11727 msg_conv.inner = (void*)(msg & (~1));
11728 msg_conv.is_owned = false;
11729 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11730 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11733 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) {
11734 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11735 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11736 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11737 LDKPublicKey their_node_id_ref;
11738 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11739 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11740 LDKUpdateFee msg_conv;
11741 msg_conv.inner = (void*)(msg & (~1));
11742 msg_conv.is_owned = false;
11743 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11744 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11747 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) {
11748 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11749 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11750 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11751 LDKPublicKey their_node_id_ref;
11752 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11753 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11754 LDKAnnouncementSignatures msg_conv;
11755 msg_conv.inner = (void*)(msg & (~1));
11756 msg_conv.is_owned = false;
11757 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11758 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11761 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) {
11762 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11763 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11764 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11765 LDKPublicKey their_node_id_ref;
11766 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11767 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11768 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
11771 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) {
11772 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11773 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11774 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11775 LDKPublicKey their_node_id_ref;
11776 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11777 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11779 msg_conv.inner = (void*)(msg & (~1));
11780 msg_conv.is_owned = false;
11781 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11782 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11785 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) {
11786 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11787 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11788 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11789 LDKPublicKey their_node_id_ref;
11790 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11791 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11792 LDKChannelReestablish msg_conv;
11793 msg_conv.inner = (void*)(msg & (~1));
11794 msg_conv.is_owned = false;
11795 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11796 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11799 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) {
11800 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11801 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11802 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11803 LDKPublicKey their_node_id_ref;
11804 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11805 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11806 LDKChannelUpdate msg_conv;
11807 msg_conv.inner = (void*)(msg & (~1));
11808 msg_conv.is_owned = false;
11809 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11810 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11813 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) {
11814 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11815 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11816 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11817 LDKPublicKey their_node_id_ref;
11818 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11819 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11820 LDKErrorMessage msg_conv;
11821 msg_conv.inner = (void*)(msg & (~1));
11822 msg_conv.is_owned = false;
11823 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11824 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11827 typedef struct LDKRoutingMessageHandler_JCalls {
11828 atomic_size_t refcnt;
11831 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11832 jmethodID handle_node_announcement_meth;
11833 jmethodID handle_channel_announcement_meth;
11834 jmethodID handle_channel_update_meth;
11835 jmethodID get_next_channel_announcements_meth;
11836 jmethodID get_next_node_announcements_meth;
11837 jmethodID peer_connected_meth;
11838 jmethodID handle_reply_channel_range_meth;
11839 jmethodID handle_reply_short_channel_ids_end_meth;
11840 jmethodID handle_query_channel_range_meth;
11841 jmethodID handle_query_short_channel_ids_meth;
11842 } LDKRoutingMessageHandler_JCalls;
11843 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11844 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11845 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11847 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11848 if (get_jenv_res == JNI_EDETACHED) {
11849 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11851 DO_ASSERT(get_jenv_res == JNI_OK);
11853 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11854 if (get_jenv_res == JNI_EDETACHED) {
11855 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11860 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11861 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11863 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11864 if (get_jenv_res == JNI_EDETACHED) {
11865 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11867 DO_ASSERT(get_jenv_res == JNI_OK);
11869 LDKNodeAnnouncement msg_var = *msg;
11870 int64_t msg_ref = 0;
11871 msg_var = NodeAnnouncement_clone(&msg_var);
11872 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11873 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11874 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11875 msg_ref = (uintptr_t)msg_var.inner;
11876 if (msg_var.is_owned) {
11879 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11880 CHECK(obj != NULL);
11881 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11882 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11883 (*env)->ExceptionDescribe(env);
11884 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11886 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11887 CHECK_ACCESS(ret_ptr);
11888 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11890 if (get_jenv_res == JNI_EDETACHED) {
11891 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11895 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
11896 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11898 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11899 if (get_jenv_res == JNI_EDETACHED) {
11900 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11902 DO_ASSERT(get_jenv_res == JNI_OK);
11904 LDKChannelAnnouncement msg_var = *msg;
11905 int64_t msg_ref = 0;
11906 msg_var = ChannelAnnouncement_clone(&msg_var);
11907 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11908 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11909 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11910 msg_ref = (uintptr_t)msg_var.inner;
11911 if (msg_var.is_owned) {
11914 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11915 CHECK(obj != NULL);
11916 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
11917 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11918 (*env)->ExceptionDescribe(env);
11919 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11921 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11922 CHECK_ACCESS(ret_ptr);
11923 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11925 if (get_jenv_res == JNI_EDETACHED) {
11926 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11930 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
11931 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11933 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11934 if (get_jenv_res == JNI_EDETACHED) {
11935 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11937 DO_ASSERT(get_jenv_res == JNI_OK);
11939 LDKChannelUpdate msg_var = *msg;
11940 int64_t msg_ref = 0;
11941 msg_var = ChannelUpdate_clone(&msg_var);
11942 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11943 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11944 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11945 msg_ref = (uintptr_t)msg_var.inner;
11946 if (msg_var.is_owned) {
11949 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11950 CHECK(obj != NULL);
11951 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
11952 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11953 (*env)->ExceptionDescribe(env);
11954 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
11956 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11957 CHECK_ACCESS(ret_ptr);
11958 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11960 if (get_jenv_res == JNI_EDETACHED) {
11961 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11965 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
11966 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11968 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11969 if (get_jenv_res == JNI_EDETACHED) {
11970 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11972 DO_ASSERT(get_jenv_res == JNI_OK);
11974 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11975 CHECK(obj != NULL);
11976 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
11977 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11978 (*env)->ExceptionDescribe(env);
11979 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11981 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
11982 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11983 if (ret_constr.datalen > 0)
11984 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11986 ret_constr.data = NULL;
11987 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11988 for (size_t h = 0; h < ret_constr.datalen; h++) {
11989 int64_t ret_conv_59 = ret_vals[h];
11990 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
11991 CHECK_ACCESS(ret_conv_59_ptr);
11992 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
11993 FREE((void*)ret_conv_59);
11994 ret_constr.data[h] = ret_conv_59_conv;
11996 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11997 if (get_jenv_res == JNI_EDETACHED) {
11998 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12002 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
12003 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12005 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12006 if (get_jenv_res == JNI_EDETACHED) {
12007 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12009 DO_ASSERT(get_jenv_res == JNI_OK);
12011 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
12012 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
12013 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12014 CHECK(obj != NULL);
12015 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
12016 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12017 (*env)->ExceptionDescribe(env);
12018 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12020 LDKCVec_NodeAnnouncementZ ret_constr;
12021 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12022 if (ret_constr.datalen > 0)
12023 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12025 ret_constr.data = NULL;
12026 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12027 for (size_t s = 0; s < ret_constr.datalen; s++) {
12028 int64_t ret_conv_18 = ret_vals[s];
12029 LDKNodeAnnouncement ret_conv_18_conv;
12030 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
12031 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
12032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
12033 ret_constr.data[s] = ret_conv_18_conv;
12035 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12036 if (get_jenv_res == JNI_EDETACHED) {
12037 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12041 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
12042 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12044 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12045 if (get_jenv_res == JNI_EDETACHED) {
12046 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12048 DO_ASSERT(get_jenv_res == JNI_OK);
12050 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12051 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12052 LDKInit init_var = *init;
12053 int64_t init_ref = 0;
12054 init_var = Init_clone(&init_var);
12055 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12056 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12057 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12058 init_ref = (uintptr_t)init_var.inner;
12059 if (init_var.is_owned) {
12062 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12063 CHECK(obj != NULL);
12064 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
12065 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12066 (*env)->ExceptionDescribe(env);
12067 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
12069 if (get_jenv_res == JNI_EDETACHED) {
12070 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12073 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12074 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12076 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12077 if (get_jenv_res == JNI_EDETACHED) {
12078 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12080 DO_ASSERT(get_jenv_res == JNI_OK);
12082 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12083 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12084 LDKReplyChannelRange msg_var = msg;
12085 int64_t msg_ref = 0;
12086 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12087 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12088 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12089 msg_ref = (uintptr_t)msg_var.inner;
12090 if (msg_var.is_owned) {
12093 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12094 CHECK(obj != NULL);
12095 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
12096 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12097 (*env)->ExceptionDescribe(env);
12098 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12100 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12101 CHECK_ACCESS(ret_ptr);
12102 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12104 if (get_jenv_res == JNI_EDETACHED) {
12105 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12109 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12110 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12112 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12113 if (get_jenv_res == JNI_EDETACHED) {
12114 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12116 DO_ASSERT(get_jenv_res == JNI_OK);
12118 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12119 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12120 LDKReplyShortChannelIdsEnd msg_var = msg;
12121 int64_t msg_ref = 0;
12122 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12123 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12124 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12125 msg_ref = (uintptr_t)msg_var.inner;
12126 if (msg_var.is_owned) {
12129 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12130 CHECK(obj != NULL);
12131 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
12132 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12133 (*env)->ExceptionDescribe(env);
12134 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
12136 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12137 CHECK_ACCESS(ret_ptr);
12138 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12140 if (get_jenv_res == JNI_EDETACHED) {
12141 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12145 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12146 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12148 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12149 if (get_jenv_res == JNI_EDETACHED) {
12150 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12152 DO_ASSERT(get_jenv_res == JNI_OK);
12154 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12155 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12156 LDKQueryChannelRange msg_var = msg;
12157 int64_t msg_ref = 0;
12158 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12159 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12160 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12161 msg_ref = (uintptr_t)msg_var.inner;
12162 if (msg_var.is_owned) {
12165 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12166 CHECK(obj != NULL);
12167 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
12168 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12169 (*env)->ExceptionDescribe(env);
12170 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12172 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12173 CHECK_ACCESS(ret_ptr);
12174 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12176 if (get_jenv_res == JNI_EDETACHED) {
12177 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12181 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12182 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12184 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12185 if (get_jenv_res == JNI_EDETACHED) {
12186 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12188 DO_ASSERT(get_jenv_res == JNI_OK);
12190 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12191 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12192 LDKQueryShortChannelIds msg_var = msg;
12193 int64_t msg_ref = 0;
12194 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12195 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12196 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12197 msg_ref = (uintptr_t)msg_var.inner;
12198 if (msg_var.is_owned) {
12201 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12202 CHECK(obj != NULL);
12203 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
12204 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12205 (*env)->ExceptionDescribe(env);
12206 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
12208 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12209 CHECK_ACCESS(ret_ptr);
12210 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12212 if (get_jenv_res == JNI_EDETACHED) {
12213 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12217 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12218 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12219 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12220 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12222 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12223 jclass c = (*env)->GetObjectClass(env, o);
12225 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12226 atomic_init(&calls->refcnt, 1);
12227 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12228 calls->o = (*env)->NewWeakGlobalRef(env, o);
12229 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
12230 CHECK(calls->handle_node_announcement_meth != NULL);
12231 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
12232 CHECK(calls->handle_channel_announcement_meth != NULL);
12233 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
12234 CHECK(calls->handle_channel_update_meth != NULL);
12235 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
12236 CHECK(calls->get_next_channel_announcements_meth != NULL);
12237 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
12238 CHECK(calls->get_next_node_announcements_meth != NULL);
12239 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12240 CHECK(calls->peer_connected_meth != NULL);
12241 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
12242 CHECK(calls->handle_reply_channel_range_meth != NULL);
12243 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
12244 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
12245 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
12246 CHECK(calls->handle_query_channel_range_meth != NULL);
12247 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
12248 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
12250 LDKRoutingMessageHandler ret = {
12251 .this_arg = (void*) calls,
12252 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12253 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12254 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12255 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
12256 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
12257 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12258 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12259 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12260 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12261 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12262 .free = LDKRoutingMessageHandler_JCalls_free,
12263 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12265 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12269 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12270 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12271 return (uint64_t)res_ptr;
12273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12274 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
12275 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
12276 DO_ASSERT((res_ptr & 1) == 0);
12277 return (int64_t)(res_ptr | 1);
12279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12280 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12281 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12282 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12283 LDKNodeAnnouncement msg_conv;
12284 msg_conv.inner = (void*)(msg & (~1));
12285 msg_conv.is_owned = false;
12286 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12287 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12288 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12289 return (int64_t)ret_conv;
12292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12293 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12294 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12295 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12296 LDKChannelAnnouncement msg_conv;
12297 msg_conv.inner = (void*)(msg & (~1));
12298 msg_conv.is_owned = false;
12299 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12300 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12301 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12302 return (int64_t)ret_conv;
12305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12306 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12307 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12308 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12309 LDKChannelUpdate msg_conv;
12310 msg_conv.inner = (void*)(msg & (~1));
12311 msg_conv.is_owned = false;
12312 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12313 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12314 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12315 return (int64_t)ret_conv;
12318 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) {
12319 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12320 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12321 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12322 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
12323 int64_tArray ret_arr = NULL;
12324 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12325 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12326 for (size_t h = 0; h < ret_var.datalen; h++) {
12327 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12328 *ret_conv_59_conv = ret_var.data[h];
12329 ret_arr_ptr[h] = ((int64_t)ret_conv_59_conv);
12331 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12332 FREE(ret_var.data);
12336 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) {
12337 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12338 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12339 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12340 LDKPublicKey starting_point_ref;
12341 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
12342 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
12343 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
12344 int64_tArray ret_arr = NULL;
12345 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12346 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12347 for (size_t s = 0; s < ret_var.datalen; s++) {
12348 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
12349 int64_t ret_conv_18_ref = 0;
12350 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12351 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
12353 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
12354 if (ret_conv_18_var.is_owned) {
12355 ret_conv_18_ref |= 1;
12357 ret_arr_ptr[s] = ret_conv_18_ref;
12359 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12360 FREE(ret_var.data);
12364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
12365 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12366 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12367 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12368 LDKPublicKey their_node_id_ref;
12369 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12370 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12372 init_conv.inner = (void*)(init & (~1));
12373 init_conv.is_owned = false;
12374 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12375 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
12378 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) {
12379 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12380 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12381 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12382 LDKPublicKey their_node_id_ref;
12383 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12384 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12385 LDKReplyChannelRange msg_conv;
12386 msg_conv.inner = (void*)(msg & (~1));
12387 msg_conv.is_owned = (msg & 1) || (msg == 0);
12388 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12389 msg_conv = ReplyChannelRange_clone(&msg_conv);
12390 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12391 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12392 return (int64_t)ret_conv;
12395 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) {
12396 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12397 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12398 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12399 LDKPublicKey their_node_id_ref;
12400 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12401 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12402 LDKReplyShortChannelIdsEnd msg_conv;
12403 msg_conv.inner = (void*)(msg & (~1));
12404 msg_conv.is_owned = (msg & 1) || (msg == 0);
12405 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12406 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12407 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12408 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12409 return (int64_t)ret_conv;
12412 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) {
12413 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12414 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12415 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12416 LDKPublicKey their_node_id_ref;
12417 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12418 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12419 LDKQueryChannelRange msg_conv;
12420 msg_conv.inner = (void*)(msg & (~1));
12421 msg_conv.is_owned = (msg & 1) || (msg == 0);
12422 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12423 msg_conv = QueryChannelRange_clone(&msg_conv);
12424 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12425 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12426 return (int64_t)ret_conv;
12429 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) {
12430 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12431 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12432 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12433 LDKPublicKey their_node_id_ref;
12434 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12435 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12436 LDKQueryShortChannelIds msg_conv;
12437 msg_conv.inner = (void*)(msg & (~1));
12438 msg_conv.is_owned = (msg & 1) || (msg == 0);
12439 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12440 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12441 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12442 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12443 return (int64_t)ret_conv;
12446 typedef struct LDKCustomMessageReader_JCalls {
12447 atomic_size_t refcnt;
12450 jmethodID read_meth;
12451 } LDKCustomMessageReader_JCalls;
12452 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
12453 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12454 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12456 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12457 if (get_jenv_res == JNI_EDETACHED) {
12458 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12460 DO_ASSERT(get_jenv_res == JNI_OK);
12462 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12463 if (get_jenv_res == JNI_EDETACHED) {
12464 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12469 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
12470 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12472 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12473 if (get_jenv_res == JNI_EDETACHED) {
12474 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12476 DO_ASSERT(get_jenv_res == JNI_OK);
12478 LDKu8slice buffer_var = buffer;
12479 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
12480 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
12481 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12482 CHECK(obj != NULL);
12483 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
12484 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12485 (*env)->ExceptionDescribe(env);
12486 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
12488 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12489 CHECK_ACCESS(ret_ptr);
12490 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
12492 if (get_jenv_res == JNI_EDETACHED) {
12493 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12497 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
12498 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
12499 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12501 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
12502 jclass c = (*env)->GetObjectClass(env, o);
12504 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
12505 atomic_init(&calls->refcnt, 1);
12506 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12507 calls->o = (*env)->NewWeakGlobalRef(env, o);
12508 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
12509 CHECK(calls->read_meth != NULL);
12511 LDKCustomMessageReader ret = {
12512 .this_arg = (void*) calls,
12513 .read = read_LDKCustomMessageReader_jcall,
12514 .free = LDKCustomMessageReader_JCalls_free,
12518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
12519 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
12520 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
12521 return (uint64_t)res_ptr;
12523 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) {
12524 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12525 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12526 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
12527 LDKu8slice buffer_ref;
12528 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
12529 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
12530 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12531 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
12532 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
12533 return (int64_t)ret_conv;
12536 typedef struct LDKCustomMessageHandler_JCalls {
12537 atomic_size_t refcnt;
12540 LDKCustomMessageReader_JCalls* CustomMessageReader;
12541 jmethodID handle_custom_message_meth;
12542 jmethodID get_and_clear_pending_msg_meth;
12543 } LDKCustomMessageHandler_JCalls;
12544 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
12545 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12546 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12548 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12549 if (get_jenv_res == JNI_EDETACHED) {
12550 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12552 DO_ASSERT(get_jenv_res == JNI_OK);
12554 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12555 if (get_jenv_res == JNI_EDETACHED) {
12556 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12561 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
12562 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12564 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12565 if (get_jenv_res == JNI_EDETACHED) {
12566 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12568 DO_ASSERT(get_jenv_res == JNI_OK);
12570 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
12572 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
12573 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
12574 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12575 CHECK(obj != NULL);
12576 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (int64_t)msg_ret, sender_node_id_arr);
12577 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12578 (*env)->ExceptionDescribe(env);
12579 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
12581 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12582 CHECK_ACCESS(ret_ptr);
12583 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12585 if (get_jenv_res == JNI_EDETACHED) {
12586 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12590 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
12591 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12593 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12594 if (get_jenv_res == JNI_EDETACHED) {
12595 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12597 DO_ASSERT(get_jenv_res == JNI_OK);
12599 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12600 CHECK(obj != NULL);
12601 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
12602 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12603 (*env)->ExceptionDescribe(env);
12604 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
12606 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
12607 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12608 if (ret_constr.datalen > 0)
12609 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12611 ret_constr.data = NULL;
12612 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12613 for (size_t z = 0; z < ret_constr.datalen; z++) {
12614 int64_t ret_conv_25 = ret_vals[z];
12615 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
12616 CHECK_ACCESS(ret_conv_25_ptr);
12617 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
12618 FREE((void*)ret_conv_25);
12619 ret_constr.data[z] = ret_conv_25_conv;
12621 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12622 if (get_jenv_res == JNI_EDETACHED) {
12623 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12627 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
12628 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
12629 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12630 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
12632 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12633 jclass c = (*env)->GetObjectClass(env, o);
12635 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
12636 atomic_init(&calls->refcnt, 1);
12637 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12638 calls->o = (*env)->NewWeakGlobalRef(env, o);
12639 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
12640 CHECK(calls->handle_custom_message_meth != NULL);
12641 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
12642 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
12644 LDKCustomMessageHandler ret = {
12645 .this_arg = (void*) calls,
12646 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
12647 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
12648 .free = LDKCustomMessageHandler_JCalls_free,
12649 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
12651 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
12654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12655 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
12656 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
12657 return (uint64_t)res_ptr;
12659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
12660 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
12661 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
12662 DO_ASSERT((res_ptr & 1) == 0);
12663 return (int64_t)(res_ptr | 1);
12665 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) {
12666 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12667 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12668 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12669 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
12670 CHECK_ACCESS(msg_ptr);
12671 LDKType msg_conv = *(LDKType*)(msg_ptr);
12672 if (msg_conv.free == LDKType_JCalls_free) {
12673 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12674 LDKType_JCalls_cloned(&msg_conv);
12676 LDKPublicKey sender_node_id_ref;
12677 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
12678 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
12679 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12680 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
12681 return (int64_t)ret_conv;
12684 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
12685 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12686 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12687 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12688 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
12689 int64_tArray ret_arr = NULL;
12690 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12691 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12692 for (size_t z = 0; z < ret_var.datalen; z++) {
12693 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12694 *ret_conv_25_conv = ret_var.data[z];
12695 ret_arr_ptr[z] = ((int64_t)ret_conv_25_conv);
12697 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12698 FREE(ret_var.data);
12702 typedef struct LDKSocketDescriptor_JCalls {
12703 atomic_size_t refcnt;
12706 jmethodID send_data_meth;
12707 jmethodID disconnect_socket_meth;
12709 jmethodID hash_meth;
12710 } LDKSocketDescriptor_JCalls;
12711 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
12712 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12713 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12715 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12716 if (get_jenv_res == JNI_EDETACHED) {
12717 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12719 DO_ASSERT(get_jenv_res == JNI_OK);
12721 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12722 if (get_jenv_res == JNI_EDETACHED) {
12723 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12728 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
12729 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12731 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12732 if (get_jenv_res == JNI_EDETACHED) {
12733 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12735 DO_ASSERT(get_jenv_res == JNI_OK);
12737 LDKu8slice data_var = data;
12738 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
12739 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
12740 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12741 CHECK(obj != NULL);
12742 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
12743 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12744 (*env)->ExceptionDescribe(env);
12745 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
12747 if (get_jenv_res == JNI_EDETACHED) {
12748 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12752 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
12753 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12755 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12756 if (get_jenv_res == JNI_EDETACHED) {
12757 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12759 DO_ASSERT(get_jenv_res == JNI_OK);
12761 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12762 CHECK(obj != NULL);
12763 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
12764 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12765 (*env)->ExceptionDescribe(env);
12766 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
12768 if (get_jenv_res == JNI_EDETACHED) {
12769 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12772 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
12773 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12775 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12776 if (get_jenv_res == JNI_EDETACHED) {
12777 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12779 DO_ASSERT(get_jenv_res == JNI_OK);
12781 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12782 *other_arg_clone = SocketDescriptor_clone(other_arg);
12783 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12784 CHECK(obj != NULL);
12785 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (int64_t)other_arg_clone);
12786 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12787 (*env)->ExceptionDescribe(env);
12788 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
12790 if (get_jenv_res == JNI_EDETACHED) {
12791 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12795 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
12796 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12798 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12799 if (get_jenv_res == JNI_EDETACHED) {
12800 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12802 DO_ASSERT(get_jenv_res == JNI_OK);
12804 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12805 CHECK(obj != NULL);
12806 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
12807 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12808 (*env)->ExceptionDescribe(env);
12809 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
12811 if (get_jenv_res == JNI_EDETACHED) {
12812 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12816 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
12817 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
12818 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12820 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
12821 jclass c = (*env)->GetObjectClass(env, o);
12823 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
12824 atomic_init(&calls->refcnt, 1);
12825 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12826 calls->o = (*env)->NewWeakGlobalRef(env, o);
12827 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
12828 CHECK(calls->send_data_meth != NULL);
12829 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
12830 CHECK(calls->disconnect_socket_meth != NULL);
12831 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
12832 CHECK(calls->eq_meth != NULL);
12833 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
12834 CHECK(calls->hash_meth != NULL);
12836 LDKSocketDescriptor ret = {
12837 .this_arg = (void*) calls,
12838 .send_data = send_data_LDKSocketDescriptor_jcall,
12839 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12840 .eq = eq_LDKSocketDescriptor_jcall,
12841 .hash = hash_LDKSocketDescriptor_jcall,
12842 .cloned = LDKSocketDescriptor_JCalls_cloned,
12843 .free = LDKSocketDescriptor_JCalls_free,
12847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12848 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12849 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12850 return (uint64_t)res_ptr;
12852 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) {
12853 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12854 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12855 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12856 LDKu8slice data_ref;
12857 data_ref.datalen = (*env)->GetArrayLength(env, data);
12858 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12859 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12860 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12865 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12866 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12867 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12868 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12872 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12873 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12874 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12875 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
12879 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
12880 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
12881 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
12882 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
12883 static jclass LDKEffectiveCapacity_Total_class = NULL;
12884 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
12885 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
12886 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
12887 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
12888 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
12889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
12890 LDKEffectiveCapacity_ExactLiquidity_class =
12891 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
12892 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
12893 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
12894 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
12895 LDKEffectiveCapacity_MaximumHTLC_class =
12896 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
12897 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
12898 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
12899 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
12900 LDKEffectiveCapacity_Total_class =
12901 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
12902 CHECK(LDKEffectiveCapacity_Total_class != NULL);
12903 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(J)V");
12904 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
12905 LDKEffectiveCapacity_Infinite_class =
12906 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
12907 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
12908 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
12909 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
12910 LDKEffectiveCapacity_Unknown_class =
12911 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
12912 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
12913 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
12914 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
12916 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12917 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
12919 case LDKEffectiveCapacity_ExactLiquidity: {
12920 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, obj->exact_liquidity.liquidity_msat);
12922 case LDKEffectiveCapacity_MaximumHTLC: {
12923 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, obj->maximum_htlc.amount_msat);
12925 case LDKEffectiveCapacity_Total: {
12926 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, obj->total.capacity_msat);
12928 case LDKEffectiveCapacity_Infinite: {
12929 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
12931 case LDKEffectiveCapacity_Unknown: {
12932 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
12937 typedef struct LDKScore_JCalls {
12938 atomic_size_t refcnt;
12941 jmethodID channel_penalty_msat_meth;
12942 jmethodID payment_path_failed_meth;
12943 jmethodID payment_path_successful_meth;
12944 jmethodID write_meth;
12946 static void LDKScore_JCalls_free(void* this_arg) {
12947 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12948 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12950 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12951 if (get_jenv_res == JNI_EDETACHED) {
12952 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12954 DO_ASSERT(get_jenv_res == JNI_OK);
12956 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12957 if (get_jenv_res == JNI_EDETACHED) {
12958 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12963 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) {
12964 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12966 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12967 if (get_jenv_res == JNI_EDETACHED) {
12968 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12970 DO_ASSERT(get_jenv_res == JNI_OK);
12972 LDKNodeId source_var = *source;
12973 int64_t source_ref = 0;
12974 source_var = NodeId_clone(&source_var);
12975 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12976 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12977 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
12978 source_ref = (uintptr_t)source_var.inner;
12979 if (source_var.is_owned) {
12982 LDKNodeId target_var = *target;
12983 int64_t target_ref = 0;
12984 target_var = NodeId_clone(&target_var);
12985 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12986 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12987 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
12988 target_ref = (uintptr_t)target_var.inner;
12989 if (target_var.is_owned) {
12992 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12993 CHECK(obj != NULL);
12994 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);
12995 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12996 (*env)->ExceptionDescribe(env);
12997 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
12999 if (get_jenv_res == JNI_EDETACHED) {
13000 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13004 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
13005 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13007 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13008 if (get_jenv_res == JNI_EDETACHED) {
13009 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13011 DO_ASSERT(get_jenv_res == JNI_OK);
13013 LDKCVec_RouteHopZ path_var = path;
13014 int64_tArray path_arr = NULL;
13015 path_arr = (*env)->NewLongArray(env, path_var.datalen);
13016 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
13017 for (size_t k = 0; k < path_var.datalen; k++) {
13018 LDKRouteHop path_conv_10_var = path_var.data[k];
13019 int64_t path_conv_10_ref = 0;
13020 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13021 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13022 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
13023 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
13024 if (path_conv_10_var.is_owned) {
13025 path_conv_10_ref |= 1;
13027 path_arr_ptr[k] = path_conv_10_ref;
13029 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
13030 FREE(path_var.data);
13031 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13032 CHECK(obj != NULL);
13033 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id);
13034 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13035 (*env)->ExceptionDescribe(env);
13036 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
13038 if (get_jenv_res == JNI_EDETACHED) {
13039 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13042 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
13043 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13045 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13046 if (get_jenv_res == JNI_EDETACHED) {
13047 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13049 DO_ASSERT(get_jenv_res == JNI_OK);
13051 LDKCVec_RouteHopZ path_var = path;
13052 int64_tArray path_arr = NULL;
13053 path_arr = (*env)->NewLongArray(env, path_var.datalen);
13054 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
13055 for (size_t k = 0; k < path_var.datalen; k++) {
13056 LDKRouteHop path_conv_10_var = path_var.data[k];
13057 int64_t path_conv_10_ref = 0;
13058 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13059 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13060 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
13061 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
13062 if (path_conv_10_var.is_owned) {
13063 path_conv_10_ref |= 1;
13065 path_arr_ptr[k] = path_conv_10_ref;
13067 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
13068 FREE(path_var.data);
13069 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13070 CHECK(obj != NULL);
13071 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
13072 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13073 (*env)->ExceptionDescribe(env);
13074 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
13076 if (get_jenv_res == JNI_EDETACHED) {
13077 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13080 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
13081 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13083 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13084 if (get_jenv_res == JNI_EDETACHED) {
13085 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13087 DO_ASSERT(get_jenv_res == JNI_OK);
13089 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13090 CHECK(obj != NULL);
13091 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
13092 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13093 (*env)->ExceptionDescribe(env);
13094 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
13096 LDKCVec_u8Z ret_ref;
13097 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
13098 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
13099 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
13100 if (get_jenv_res == JNI_EDETACHED) {
13101 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13105 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
13106 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
13107 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13109 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
13110 jclass c = (*env)->GetObjectClass(env, o);
13112 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
13113 atomic_init(&calls->refcnt, 1);
13114 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13115 calls->o = (*env)->NewWeakGlobalRef(env, o);
13116 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
13117 CHECK(calls->channel_penalty_msat_meth != NULL);
13118 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
13119 CHECK(calls->payment_path_failed_meth != NULL);
13120 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
13121 CHECK(calls->payment_path_successful_meth != NULL);
13122 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
13123 CHECK(calls->write_meth != NULL);
13126 .this_arg = (void*) calls,
13127 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
13128 .payment_path_failed = payment_path_failed_LDKScore_jcall,
13129 .payment_path_successful = payment_path_successful_LDKScore_jcall,
13130 .write = write_LDKScore_jcall,
13131 .free = LDKScore_JCalls_free,
13135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
13136 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
13137 *res_ptr = LDKScore_init(env, clz, o);
13138 return (uint64_t)res_ptr;
13140 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) {
13141 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13142 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13143 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13144 LDKNodeId source_conv;
13145 source_conv.inner = (void*)(source & (~1));
13146 source_conv.is_owned = false;
13147 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
13148 LDKNodeId target_conv;
13149 target_conv.inner = (void*)(target & (~1));
13150 target_conv.is_owned = false;
13151 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
13152 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);
13156 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) {
13157 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13158 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13159 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13160 LDKCVec_RouteHopZ path_constr;
13161 path_constr.datalen = (*env)->GetArrayLength(env, path);
13162 if (path_constr.datalen > 0)
13163 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13165 path_constr.data = NULL;
13166 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
13167 for (size_t k = 0; k < path_constr.datalen; k++) {
13168 int64_t path_conv_10 = path_vals[k];
13169 LDKRouteHop path_conv_10_conv;
13170 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
13171 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
13172 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
13173 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
13174 path_constr.data[k] = path_conv_10_conv;
13176 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
13177 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
13180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
13181 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13182 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13183 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13184 LDKCVec_RouteHopZ path_constr;
13185 path_constr.datalen = (*env)->GetArrayLength(env, path);
13186 if (path_constr.datalen > 0)
13187 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13189 path_constr.data = NULL;
13190 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
13191 for (size_t k = 0; k < path_constr.datalen; k++) {
13192 int64_t path_conv_10 = path_vals[k];
13193 LDKRouteHop path_conv_10_conv;
13194 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
13195 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
13196 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
13197 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
13198 path_constr.data[k] = path_conv_10_conv;
13200 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
13201 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
13204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
13205 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13206 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13207 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13208 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
13209 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13210 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13211 CVec_u8Z_free(ret_var);
13215 typedef struct LDKLockableScore_JCalls {
13216 atomic_size_t refcnt;
13219 jmethodID lock_meth;
13220 } LDKLockableScore_JCalls;
13221 static void LDKLockableScore_JCalls_free(void* this_arg) {
13222 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13223 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13225 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13226 if (get_jenv_res == JNI_EDETACHED) {
13227 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13229 DO_ASSERT(get_jenv_res == JNI_OK);
13231 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13232 if (get_jenv_res == JNI_EDETACHED) {
13233 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13238 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
13239 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13241 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13242 if (get_jenv_res == JNI_EDETACHED) {
13243 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13245 DO_ASSERT(get_jenv_res == JNI_OK);
13247 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13248 CHECK(obj != NULL);
13249 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
13250 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13251 (*env)->ExceptionDescribe(env);
13252 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
13254 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13255 CHECK_ACCESS(ret_ptr);
13256 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
13257 if (ret_conv.free == LDKScore_JCalls_free) {
13258 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13259 LDKScore_JCalls_cloned(&ret_conv);
13260 }// WARNING: we may need a move here but no clone is available for LDKScore
13262 if (get_jenv_res == JNI_EDETACHED) {
13263 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13267 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
13268 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
13269 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13271 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
13272 jclass c = (*env)->GetObjectClass(env, o);
13274 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
13275 atomic_init(&calls->refcnt, 1);
13276 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13277 calls->o = (*env)->NewWeakGlobalRef(env, o);
13278 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
13279 CHECK(calls->lock_meth != NULL);
13281 LDKLockableScore ret = {
13282 .this_arg = (void*) calls,
13283 .lock = lock_LDKLockableScore_jcall,
13284 .free = LDKLockableScore_JCalls_free,
13288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
13289 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
13290 *res_ptr = LDKLockableScore_init(env, clz, o);
13291 return (uint64_t)res_ptr;
13293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
13294 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13295 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13296 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
13297 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
13298 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
13299 return (int64_t)ret_ret;
13302 typedef struct LDKPersister_JCalls {
13303 atomic_size_t refcnt;
13306 jmethodID persist_manager_meth;
13307 jmethodID persist_graph_meth;
13308 } LDKPersister_JCalls;
13309 static void LDKPersister_JCalls_free(void* this_arg) {
13310 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13311 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13313 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13314 if (get_jenv_res == JNI_EDETACHED) {
13315 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13317 DO_ASSERT(get_jenv_res == JNI_OK);
13319 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13320 if (get_jenv_res == JNI_EDETACHED) {
13321 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13326 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
13327 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13329 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13330 if (get_jenv_res == JNI_EDETACHED) {
13331 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13333 DO_ASSERT(get_jenv_res == JNI_OK);
13335 LDKChannelManager channel_manager_var = *channel_manager;
13336 int64_t channel_manager_ref = 0;
13337 // WARNING: we may need a move here but no clone is available for LDKChannelManager
13338 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13339 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13340 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
13341 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
13342 if (channel_manager_var.is_owned) {
13343 channel_manager_ref |= 1;
13345 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13346 CHECK(obj != NULL);
13347 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
13348 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13349 (*env)->ExceptionDescribe(env);
13350 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
13352 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13353 CHECK_ACCESS(ret_ptr);
13354 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13356 if (get_jenv_res == JNI_EDETACHED) {
13357 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13361 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
13362 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13364 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13365 if (get_jenv_res == JNI_EDETACHED) {
13366 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13368 DO_ASSERT(get_jenv_res == JNI_OK);
13370 LDKNetworkGraph network_graph_var = *network_graph;
13371 int64_t network_graph_ref = 0;
13372 network_graph_var = NetworkGraph_clone(&network_graph_var);
13373 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13374 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13375 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
13376 network_graph_ref = (uintptr_t)network_graph_var.inner;
13377 if (network_graph_var.is_owned) {
13378 network_graph_ref |= 1;
13380 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13381 CHECK(obj != NULL);
13382 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
13383 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13384 (*env)->ExceptionDescribe(env);
13385 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
13387 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13388 CHECK_ACCESS(ret_ptr);
13389 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13391 if (get_jenv_res == JNI_EDETACHED) {
13392 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13396 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
13397 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
13398 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13400 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
13401 jclass c = (*env)->GetObjectClass(env, o);
13403 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
13404 atomic_init(&calls->refcnt, 1);
13405 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13406 calls->o = (*env)->NewWeakGlobalRef(env, o);
13407 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
13408 CHECK(calls->persist_manager_meth != NULL);
13409 calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
13410 CHECK(calls->persist_graph_meth != NULL);
13412 LDKPersister ret = {
13413 .this_arg = (void*) calls,
13414 .persist_manager = persist_manager_LDKPersister_jcall,
13415 .persist_graph = persist_graph_LDKPersister_jcall,
13416 .free = LDKPersister_JCalls_free,
13420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
13421 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
13422 *res_ptr = LDKPersister_init(env, clz, o);
13423 return (uint64_t)res_ptr;
13425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
13426 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13427 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13428 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13429 LDKChannelManager channel_manager_conv;
13430 channel_manager_conv.inner = (void*)(channel_manager & (~1));
13431 channel_manager_conv.is_owned = false;
13432 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13433 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
13434 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13435 return (int64_t)ret_conv;
13438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
13439 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13440 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13441 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13442 LDKNetworkGraph network_graph_conv;
13443 network_graph_conv.inner = (void*)(network_graph & (~1));
13444 network_graph_conv.is_owned = false;
13445 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
13446 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
13447 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
13448 return (int64_t)ret_conv;
13451 static jclass LDKFallback_SegWitProgram_class = NULL;
13452 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13453 static jclass LDKFallback_PubKeyHash_class = NULL;
13454 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13455 static jclass LDKFallback_ScriptHash_class = NULL;
13456 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13458 LDKFallback_SegWitProgram_class =
13459 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13460 CHECK(LDKFallback_SegWitProgram_class != NULL);
13461 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13462 CHECK(LDKFallback_SegWitProgram_meth != NULL);
13463 LDKFallback_PubKeyHash_class =
13464 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13465 CHECK(LDKFallback_PubKeyHash_class != NULL);
13466 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13467 CHECK(LDKFallback_PubKeyHash_meth != NULL);
13468 LDKFallback_ScriptHash_class =
13469 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13470 CHECK(LDKFallback_ScriptHash_class != NULL);
13471 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13472 CHECK(LDKFallback_ScriptHash_meth != NULL);
13474 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13475 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
13477 case LDKFallback_SegWitProgram: {
13478 uint8_t version_val = obj->seg_wit_program.version._0;
13479 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13480 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13481 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13482 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13484 case LDKFallback_PubKeyHash: {
13485 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13486 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13487 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13489 case LDKFallback_ScriptHash: {
13490 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13491 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13492 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13497 typedef struct LDKPayer_JCalls {
13498 atomic_size_t refcnt;
13501 jmethodID node_id_meth;
13502 jmethodID first_hops_meth;
13503 jmethodID send_payment_meth;
13504 jmethodID send_spontaneous_payment_meth;
13505 jmethodID retry_payment_meth;
13506 jmethodID abandon_payment_meth;
13508 static void LDKPayer_JCalls_free(void* this_arg) {
13509 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13510 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13512 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13513 if (get_jenv_res == JNI_EDETACHED) {
13514 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13516 DO_ASSERT(get_jenv_res == JNI_OK);
13518 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13519 if (get_jenv_res == JNI_EDETACHED) {
13520 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13525 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13526 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13528 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13529 if (get_jenv_res == JNI_EDETACHED) {
13530 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13532 DO_ASSERT(get_jenv_res == JNI_OK);
13534 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13535 CHECK(obj != NULL);
13536 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13537 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13538 (*env)->ExceptionDescribe(env);
13539 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13541 LDKPublicKey ret_ref;
13542 CHECK((*env)->GetArrayLength(env, ret) == 33);
13543 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13544 if (get_jenv_res == JNI_EDETACHED) {
13545 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13549 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13550 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13552 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13553 if (get_jenv_res == JNI_EDETACHED) {
13554 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13556 DO_ASSERT(get_jenv_res == JNI_OK);
13558 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13559 CHECK(obj != NULL);
13560 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13561 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13562 (*env)->ExceptionDescribe(env);
13563 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13565 LDKCVec_ChannelDetailsZ ret_constr;
13566 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13567 if (ret_constr.datalen > 0)
13568 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13570 ret_constr.data = NULL;
13571 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13572 for (size_t q = 0; q < ret_constr.datalen; q++) {
13573 int64_t ret_conv_16 = ret_vals[q];
13574 LDKChannelDetails ret_conv_16_conv;
13575 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
13576 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
13577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13578 ret_constr.data[q] = ret_conv_16_conv;
13580 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13581 if (get_jenv_res == JNI_EDETACHED) {
13582 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13586 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13587 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13589 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13590 if (get_jenv_res == JNI_EDETACHED) {
13591 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13593 DO_ASSERT(get_jenv_res == JNI_OK);
13595 LDKRoute route_var = *route;
13596 int64_t route_ref = 0;
13597 route_var = Route_clone(&route_var);
13598 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13599 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13600 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13601 route_ref = (uintptr_t)route_var.inner;
13602 if (route_var.is_owned) {
13605 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13606 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13607 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13608 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13609 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13610 CHECK(obj != NULL);
13611 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13612 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13613 (*env)->ExceptionDescribe(env);
13614 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13616 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13617 CHECK_ACCESS(ret_ptr);
13618 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13620 if (get_jenv_res == JNI_EDETACHED) {
13621 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13625 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
13626 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13628 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13629 if (get_jenv_res == JNI_EDETACHED) {
13630 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13632 DO_ASSERT(get_jenv_res == JNI_OK);
13634 LDKRoute route_var = *route;
13635 int64_t route_ref = 0;
13636 route_var = Route_clone(&route_var);
13637 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13638 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13639 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13640 route_ref = (uintptr_t)route_var.inner;
13641 if (route_var.is_owned) {
13644 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13645 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13646 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13647 CHECK(obj != NULL);
13648 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13649 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13650 (*env)->ExceptionDescribe(env);
13651 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13653 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13654 CHECK_ACCESS(ret_ptr);
13655 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13657 if (get_jenv_res == JNI_EDETACHED) {
13658 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13662 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
13663 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13665 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13666 if (get_jenv_res == JNI_EDETACHED) {
13667 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13669 DO_ASSERT(get_jenv_res == JNI_OK);
13671 LDKRoute route_var = *route;
13672 int64_t route_ref = 0;
13673 route_var = Route_clone(&route_var);
13674 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13675 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13676 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13677 route_ref = (uintptr_t)route_var.inner;
13678 if (route_var.is_owned) {
13681 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13682 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13683 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13684 CHECK(obj != NULL);
13685 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
13686 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13687 (*env)->ExceptionDescribe(env);
13688 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
13690 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13691 CHECK_ACCESS(ret_ptr);
13692 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
13694 if (get_jenv_res == JNI_EDETACHED) {
13695 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13699 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
13700 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13702 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13703 if (get_jenv_res == JNI_EDETACHED) {
13704 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13706 DO_ASSERT(get_jenv_res == JNI_OK);
13708 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13709 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13710 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13711 CHECK(obj != NULL);
13712 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
13713 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13714 (*env)->ExceptionDescribe(env);
13715 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
13717 if (get_jenv_res == JNI_EDETACHED) {
13718 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13721 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
13722 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
13723 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13725 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
13726 jclass c = (*env)->GetObjectClass(env, o);
13728 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
13729 atomic_init(&calls->refcnt, 1);
13730 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13731 calls->o = (*env)->NewWeakGlobalRef(env, o);
13732 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
13733 CHECK(calls->node_id_meth != NULL);
13734 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
13735 CHECK(calls->first_hops_meth != NULL);
13736 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
13737 CHECK(calls->send_payment_meth != NULL);
13738 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
13739 CHECK(calls->send_spontaneous_payment_meth != NULL);
13740 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
13741 CHECK(calls->retry_payment_meth != NULL);
13742 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
13743 CHECK(calls->abandon_payment_meth != NULL);
13746 .this_arg = (void*) calls,
13747 .node_id = node_id_LDKPayer_jcall,
13748 .first_hops = first_hops_LDKPayer_jcall,
13749 .send_payment = send_payment_LDKPayer_jcall,
13750 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
13751 .retry_payment = retry_payment_LDKPayer_jcall,
13752 .abandon_payment = abandon_payment_LDKPayer_jcall,
13753 .free = LDKPayer_JCalls_free,
13757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
13758 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
13759 *res_ptr = LDKPayer_init(env, clz, o);
13760 return (uint64_t)res_ptr;
13762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13763 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13764 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13765 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13766 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13767 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
13771 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
13772 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13773 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13774 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13775 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
13776 int64_tArray ret_arr = NULL;
13777 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13778 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13779 for (size_t q = 0; q < ret_var.datalen; q++) {
13780 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
13781 int64_t ret_conv_16_ref = 0;
13782 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13783 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
13785 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
13786 if (ret_conv_16_var.is_owned) {
13787 ret_conv_16_ref |= 1;
13789 ret_arr_ptr[q] = ret_conv_16_ref;
13791 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13792 FREE(ret_var.data);
13796 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) {
13797 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13798 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13799 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13800 LDKRoute route_conv;
13801 route_conv.inner = (void*)(route & (~1));
13802 route_conv.is_owned = false;
13803 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13804 LDKThirtyTwoBytes payment_hash_ref;
13805 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13806 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13807 LDKThirtyTwoBytes payment_secret_ref;
13808 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13809 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13810 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13811 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
13812 return (int64_t)ret_conv;
13815 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) {
13816 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13817 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13818 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13819 LDKRoute route_conv;
13820 route_conv.inner = (void*)(route & (~1));
13821 route_conv.is_owned = false;
13822 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13823 LDKThirtyTwoBytes payment_preimage_ref;
13824 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13825 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13826 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13827 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
13828 return (int64_t)ret_conv;
13831 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) {
13832 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13833 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13834 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13835 LDKRoute route_conv;
13836 route_conv.inner = (void*)(route & (~1));
13837 route_conv.is_owned = false;
13838 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13839 LDKThirtyTwoBytes payment_id_ref;
13840 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13841 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13842 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13843 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
13844 return (int64_t)ret_conv;
13847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
13848 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13849 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13850 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13851 LDKThirtyTwoBytes payment_id_ref;
13852 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13853 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13854 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
13857 typedef struct LDKRouter_JCalls {
13858 atomic_size_t refcnt;
13861 jmethodID find_route_meth;
13862 } LDKRouter_JCalls;
13863 static void LDKRouter_JCalls_free(void* this_arg) {
13864 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13865 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13867 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13868 if (get_jenv_res == JNI_EDETACHED) {
13869 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13871 DO_ASSERT(get_jenv_res == JNI_OK);
13873 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13874 if (get_jenv_res == JNI_EDETACHED) {
13875 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13880 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) {
13881 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13883 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13884 if (get_jenv_res == JNI_EDETACHED) {
13885 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13887 DO_ASSERT(get_jenv_res == JNI_OK);
13889 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
13890 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
13891 LDKRouteParameters route_params_var = *route_params;
13892 int64_t route_params_ref = 0;
13893 route_params_var = RouteParameters_clone(&route_params_var);
13894 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13895 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13896 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
13897 route_params_ref = (uintptr_t)route_params_var.inner;
13898 if (route_params_var.is_owned) {
13899 route_params_ref |= 1;
13901 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13902 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
13903 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
13904 int64_tArray first_hops_arr = NULL;
13905 if (first_hops != NULL) {
13906 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
13907 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
13908 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
13909 for (size_t q = 0; q < first_hops_var.datalen; q++) {
13910 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
13911 int64_t first_hops_conv_16_ref = 0;
13912 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13913 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13914 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
13915 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
13916 if (first_hops_conv_16_var.is_owned) {
13917 first_hops_conv_16_ref |= 1;
13919 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
13921 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
13923 // WARNING: This object doesn't live past this scope, needs clone!
13924 int64_t ret_scorer = ((uintptr_t)scorer) | 1;
13925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13926 CHECK(obj != NULL);
13927 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);
13928 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13929 (*env)->ExceptionDescribe(env);
13930 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
13932 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13933 CHECK_ACCESS(ret_ptr);
13934 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
13936 if (get_jenv_res == JNI_EDETACHED) {
13937 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13941 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
13942 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
13943 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13945 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
13946 jclass c = (*env)->GetObjectClass(env, o);
13948 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
13949 atomic_init(&calls->refcnt, 1);
13950 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13951 calls->o = (*env)->NewWeakGlobalRef(env, o);
13952 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
13953 CHECK(calls->find_route_meth != NULL);
13956 .this_arg = (void*) calls,
13957 .find_route = find_route_LDKRouter_jcall,
13958 .free = LDKRouter_JCalls_free,
13962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
13963 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
13964 *res_ptr = LDKRouter_init(env, clz, o);
13965 return (uint64_t)res_ptr;
13967 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) {
13968 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13969 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13970 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
13971 LDKPublicKey payer_ref;
13972 CHECK((*env)->GetArrayLength(env, payer) == 33);
13973 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
13974 LDKRouteParameters route_params_conv;
13975 route_params_conv.inner = (void*)(route_params & (~1));
13976 route_params_conv.is_owned = false;
13977 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
13978 unsigned char payment_hash_arr[32];
13979 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13980 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
13981 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
13982 LDKCVec_ChannelDetailsZ first_hops_constr;
13983 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
13984 if (first_hops != NULL) {
13985 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
13986 if (first_hops_constr.datalen > 0)
13987 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13989 first_hops_constr.data = NULL;
13990 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
13991 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13992 int64_t first_hops_conv_16 = first_hops_vals[q];
13993 LDKChannelDetails first_hops_conv_16_conv;
13994 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
13995 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
13996 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
13997 first_hops_constr.data[q] = first_hops_conv_16_conv;
13999 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
14000 first_hops_ptr = &first_hops_constr;
14002 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
14003 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
14004 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
14005 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14006 *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);
14007 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
14008 return (int64_t)ret_conv;
14011 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14012 LDKStr ret_str = _ldk_get_compiled_version();
14013 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14018 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14019 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14020 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14025 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14026 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14027 *ret_copy = Bech32Error_clone(arg);
14028 int64_t ret_ref = (uintptr_t)ret_copy;
14031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14032 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
14033 int64_t ret_val = Bech32Error_clone_ptr(arg_conv);
14037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14038 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
14039 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14040 *ret_copy = Bech32Error_clone(orig_conv);
14041 int64_t ret_ref = (uintptr_t)ret_copy;
14045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
14046 if ((o & 1) != 0) return;
14047 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14048 CHECK_ACCESS(o_ptr);
14049 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14051 Bech32Error_free(o_conv);
14054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
14055 LDKTransaction _res_ref;
14056 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
14057 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14058 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
14059 _res_ref.data_is_owned = true;
14060 Transaction_free(_res_ref);
14063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
14064 LDKCVec_u8Z script_pubkey_ref;
14065 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14066 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14067 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
14068 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14069 *ret_ref = TxOut_new(script_pubkey_ref, value);
14070 return (int64_t)ret_ref;
14073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
14074 if ((_res & 1) != 0) return;
14075 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14076 CHECK_ACCESS(_res_ptr);
14077 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14079 TxOut_free(_res_conv);
14082 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14083 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14084 *ret_ref = TxOut_clone(arg);
14085 return (int64_t)ret_ref;
14087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14088 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
14089 int64_t ret_val = TxOut_clone_ptr(arg_conv);
14093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14094 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
14095 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14096 *ret_ref = TxOut_clone(orig_conv);
14097 return (int64_t)ret_ref;
14100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
14101 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
14106 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14107 *ret_conv = CResult_NoneNoneZ_ok();
14108 return (int64_t)ret_conv;
14111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
14112 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14113 *ret_conv = CResult_NoneNoneZ_err();
14114 return (int64_t)ret_conv;
14117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14118 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
14119 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
14123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14124 if ((_res & 1) != 0) return;
14125 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14126 CHECK_ACCESS(_res_ptr);
14127 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14129 CResult_NoneNoneZ_free(_res_conv);
14132 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14133 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14134 *ret_conv = CResult_NoneNoneZ_clone(arg);
14135 return (int64_t)ret_conv;
14137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14138 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
14139 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
14143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14144 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
14145 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14146 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14147 return (int64_t)ret_conv;
14150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14151 LDKCounterpartyCommitmentSecrets o_conv;
14152 o_conv.inner = (void*)(o & (~1));
14153 o_conv.is_owned = (o & 1) || (o == 0);
14154 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14155 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14156 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14157 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14158 return (int64_t)ret_conv;
14161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14162 LDKDecodeError e_conv;
14163 e_conv.inner = (void*)(e & (~1));
14164 e_conv.is_owned = (e & 1) || (e == 0);
14165 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14166 e_conv = DecodeError_clone(&e_conv);
14167 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14168 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14169 return (int64_t)ret_conv;
14172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14173 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
14174 jboolean ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14179 if ((_res & 1) != 0) return;
14180 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14181 CHECK_ACCESS(_res_ptr);
14182 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14184 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14187 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14188 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14189 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14190 return (int64_t)ret_conv;
14192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14193 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
14194 int64_t ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14199 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
14200 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14201 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
14202 return (int64_t)ret_conv;
14205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14206 LDKSecretKey o_ref;
14207 CHECK((*env)->GetArrayLength(env, o) == 32);
14208 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
14209 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14210 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
14211 return (int64_t)ret_conv;
14214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14215 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14216 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14217 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
14218 return (int64_t)ret_conv;
14221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14222 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
14223 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
14227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14228 if ((_res & 1) != 0) return;
14229 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14230 CHECK_ACCESS(_res_ptr);
14231 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
14233 CResult_SecretKeyErrorZ_free(_res_conv);
14236 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
14237 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14238 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
14239 return (int64_t)ret_conv;
14241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14242 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
14243 int64_t ret_val = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
14247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14248 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
14249 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14250 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
14251 return (int64_t)ret_conv;
14254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14255 LDKPublicKey o_ref;
14256 CHECK((*env)->GetArrayLength(env, o) == 33);
14257 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
14258 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14259 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
14260 return (int64_t)ret_conv;
14263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14264 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14265 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14266 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
14267 return (int64_t)ret_conv;
14270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14271 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
14272 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
14276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14277 if ((_res & 1) != 0) return;
14278 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14279 CHECK_ACCESS(_res_ptr);
14280 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
14282 CResult_PublicKeyErrorZ_free(_res_conv);
14285 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
14286 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14287 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
14288 return (int64_t)ret_conv;
14290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14291 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
14292 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
14296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14297 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
14298 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14299 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
14300 return (int64_t)ret_conv;
14303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14304 LDKTxCreationKeys o_conv;
14305 o_conv.inner = (void*)(o & (~1));
14306 o_conv.is_owned = (o & 1) || (o == 0);
14307 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14308 o_conv = TxCreationKeys_clone(&o_conv);
14309 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14310 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14311 return (int64_t)ret_conv;
14314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14315 LDKDecodeError e_conv;
14316 e_conv.inner = (void*)(e & (~1));
14317 e_conv.is_owned = (e & 1) || (e == 0);
14318 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14319 e_conv = DecodeError_clone(&e_conv);
14320 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14321 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14322 return (int64_t)ret_conv;
14325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14326 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
14327 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14332 if ((_res & 1) != 0) return;
14333 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14334 CHECK_ACCESS(_res_ptr);
14335 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14337 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14340 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14341 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14342 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14343 return (int64_t)ret_conv;
14345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14346 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
14347 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14352 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
14353 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14354 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14355 return (int64_t)ret_conv;
14358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14359 LDKChannelPublicKeys o_conv;
14360 o_conv.inner = (void*)(o & (~1));
14361 o_conv.is_owned = (o & 1) || (o == 0);
14362 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14363 o_conv = ChannelPublicKeys_clone(&o_conv);
14364 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14365 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14366 return (int64_t)ret_conv;
14369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14370 LDKDecodeError e_conv;
14371 e_conv.inner = (void*)(e & (~1));
14372 e_conv.is_owned = (e & 1) || (e == 0);
14373 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14374 e_conv = DecodeError_clone(&e_conv);
14375 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14376 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14377 return (int64_t)ret_conv;
14380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14381 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
14382 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14387 if ((_res & 1) != 0) return;
14388 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14389 CHECK_ACCESS(_res_ptr);
14390 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
14392 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
14395 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
14396 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14397 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
14398 return (int64_t)ret_conv;
14400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14401 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
14402 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
14406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14407 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
14408 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14409 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
14410 return (int64_t)ret_conv;
14413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14414 LDKTxCreationKeys o_conv;
14415 o_conv.inner = (void*)(o & (~1));
14416 o_conv.is_owned = (o & 1) || (o == 0);
14417 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14418 o_conv = TxCreationKeys_clone(&o_conv);
14419 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14420 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
14421 return (int64_t)ret_conv;
14424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14425 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14426 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14427 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
14428 return (int64_t)ret_conv;
14431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14432 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
14433 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
14437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14438 if ((_res & 1) != 0) return;
14439 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14440 CHECK_ACCESS(_res_ptr);
14441 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14443 CResult_TxCreationKeysErrorZ_free(_res_conv);
14446 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14447 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14448 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14449 return (int64_t)ret_conv;
14451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14452 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
14453 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14458 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
14459 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14460 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14461 return (int64_t)ret_conv;
14464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14465 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14466 *ret_copy = COption_u32Z_some(o);
14467 int64_t ret_ref = (uintptr_t)ret_copy;
14471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14472 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14473 *ret_copy = COption_u32Z_none();
14474 int64_t ret_ref = (uintptr_t)ret_copy;
14478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14479 if ((_res & 1) != 0) return;
14480 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14481 CHECK_ACCESS(_res_ptr);
14482 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14484 COption_u32Z_free(_res_conv);
14487 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14488 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14489 *ret_copy = COption_u32Z_clone(arg);
14490 int64_t ret_ref = (uintptr_t)ret_copy;
14493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14494 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
14495 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
14499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14500 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
14501 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14502 *ret_copy = COption_u32Z_clone(orig_conv);
14503 int64_t ret_ref = (uintptr_t)ret_copy;
14507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14508 LDKHTLCOutputInCommitment o_conv;
14509 o_conv.inner = (void*)(o & (~1));
14510 o_conv.is_owned = (o & 1) || (o == 0);
14511 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14512 o_conv = HTLCOutputInCommitment_clone(&o_conv);
14513 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14514 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14515 return (int64_t)ret_conv;
14518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14519 LDKDecodeError e_conv;
14520 e_conv.inner = (void*)(e & (~1));
14521 e_conv.is_owned = (e & 1) || (e == 0);
14522 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14523 e_conv = DecodeError_clone(&e_conv);
14524 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14525 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14526 return (int64_t)ret_conv;
14529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14530 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
14531 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14536 if ((_res & 1) != 0) return;
14537 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14538 CHECK_ACCESS(_res_ptr);
14539 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14541 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14544 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14545 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14546 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14547 return (int64_t)ret_conv;
14549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14550 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
14551 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14556 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
14557 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14558 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14559 return (int64_t)ret_conv;
14562 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14563 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14567 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14568 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14573 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14574 COption_NoneZ_free(_res_conv);
14577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14578 LDKCounterpartyChannelTransactionParameters o_conv;
14579 o_conv.inner = (void*)(o & (~1));
14580 o_conv.is_owned = (o & 1) || (o == 0);
14581 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14582 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14583 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14584 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14585 return (int64_t)ret_conv;
14588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14589 LDKDecodeError e_conv;
14590 e_conv.inner = (void*)(e & (~1));
14591 e_conv.is_owned = (e & 1) || (e == 0);
14592 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14593 e_conv = DecodeError_clone(&e_conv);
14594 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14595 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14596 return (int64_t)ret_conv;
14599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14600 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14601 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14606 if ((_res & 1) != 0) return;
14607 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14608 CHECK_ACCESS(_res_ptr);
14609 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14611 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14614 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14615 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14616 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14617 return (int64_t)ret_conv;
14619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14620 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14621 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14626 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14627 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14628 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14629 return (int64_t)ret_conv;
14632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14633 LDKChannelTransactionParameters o_conv;
14634 o_conv.inner = (void*)(o & (~1));
14635 o_conv.is_owned = (o & 1) || (o == 0);
14636 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14637 o_conv = ChannelTransactionParameters_clone(&o_conv);
14638 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14639 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14640 return (int64_t)ret_conv;
14643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14644 LDKDecodeError e_conv;
14645 e_conv.inner = (void*)(e & (~1));
14646 e_conv.is_owned = (e & 1) || (e == 0);
14647 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14648 e_conv = DecodeError_clone(&e_conv);
14649 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14650 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
14651 return (int64_t)ret_conv;
14654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14655 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14656 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14661 if ((_res & 1) != 0) return;
14662 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14663 CHECK_ACCESS(_res_ptr);
14664 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14666 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14669 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14670 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14671 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
14672 return (int64_t)ret_conv;
14674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14675 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14676 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14681 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14682 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14683 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14684 return (int64_t)ret_conv;
14687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14688 LDKCVec_SignatureZ _res_constr;
14689 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14690 if (_res_constr.datalen > 0)
14691 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14693 _res_constr.data = NULL;
14694 for (size_t i = 0; i < _res_constr.datalen; i++) {
14695 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14696 LDKSignature _res_conv_8_ref;
14697 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
14698 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
14699 _res_constr.data[i] = _res_conv_8_ref;
14701 CVec_SignatureZ_free(_res_constr);
14704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14705 LDKHolderCommitmentTransaction o_conv;
14706 o_conv.inner = (void*)(o & (~1));
14707 o_conv.is_owned = (o & 1) || (o == 0);
14708 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14709 o_conv = HolderCommitmentTransaction_clone(&o_conv);
14710 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14711 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
14712 return (int64_t)ret_conv;
14715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14716 LDKDecodeError e_conv;
14717 e_conv.inner = (void*)(e & (~1));
14718 e_conv.is_owned = (e & 1) || (e == 0);
14719 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14720 e_conv = DecodeError_clone(&e_conv);
14721 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14722 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
14723 return (int64_t)ret_conv;
14726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14727 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
14728 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14733 if ((_res & 1) != 0) return;
14734 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14735 CHECK_ACCESS(_res_ptr);
14736 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14738 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
14741 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14742 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14743 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
14744 return (int64_t)ret_conv;
14746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14747 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14748 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14753 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14754 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14755 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14756 return (int64_t)ret_conv;
14759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14760 LDKBuiltCommitmentTransaction o_conv;
14761 o_conv.inner = (void*)(o & (~1));
14762 o_conv.is_owned = (o & 1) || (o == 0);
14763 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14764 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
14765 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14766 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
14767 return (int64_t)ret_conv;
14770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14771 LDKDecodeError e_conv;
14772 e_conv.inner = (void*)(e & (~1));
14773 e_conv.is_owned = (e & 1) || (e == 0);
14774 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14775 e_conv = DecodeError_clone(&e_conv);
14776 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14777 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
14778 return (int64_t)ret_conv;
14781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14782 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
14783 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14788 if ((_res & 1) != 0) return;
14789 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14790 CHECK_ACCESS(_res_ptr);
14791 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14793 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
14796 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14797 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14798 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
14799 return (int64_t)ret_conv;
14801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14802 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14803 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14808 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14809 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14810 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14811 return (int64_t)ret_conv;
14814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14815 LDKTrustedClosingTransaction o_conv;
14816 o_conv.inner = (void*)(o & (~1));
14817 o_conv.is_owned = (o & 1) || (o == 0);
14818 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14819 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
14820 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14821 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
14822 return (int64_t)ret_conv;
14825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14826 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14827 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
14828 return (int64_t)ret_conv;
14831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14832 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
14833 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
14837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14838 if ((_res & 1) != 0) return;
14839 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14840 CHECK_ACCESS(_res_ptr);
14841 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
14843 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
14846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14847 LDKCommitmentTransaction o_conv;
14848 o_conv.inner = (void*)(o & (~1));
14849 o_conv.is_owned = (o & 1) || (o == 0);
14850 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14851 o_conv = CommitmentTransaction_clone(&o_conv);
14852 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14853 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
14854 return (int64_t)ret_conv;
14857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14858 LDKDecodeError e_conv;
14859 e_conv.inner = (void*)(e & (~1));
14860 e_conv.is_owned = (e & 1) || (e == 0);
14861 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14862 e_conv = DecodeError_clone(&e_conv);
14863 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14864 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
14865 return (int64_t)ret_conv;
14868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14869 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
14870 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14875 if ((_res & 1) != 0) return;
14876 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14877 CHECK_ACCESS(_res_ptr);
14878 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
14880 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
14883 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14884 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14885 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
14886 return (int64_t)ret_conv;
14888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14889 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
14890 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14895 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
14896 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14897 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
14898 return (int64_t)ret_conv;
14901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14902 LDKTrustedCommitmentTransaction o_conv;
14903 o_conv.inner = (void*)(o & (~1));
14904 o_conv.is_owned = (o & 1) || (o == 0);
14905 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14906 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
14907 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14908 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
14909 return (int64_t)ret_conv;
14912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14913 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14914 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
14915 return (int64_t)ret_conv;
14918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14919 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
14920 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
14924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14925 if ((_res & 1) != 0) return;
14926 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14927 CHECK_ACCESS(_res_ptr);
14928 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
14930 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
14933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14934 LDKCVec_SignatureZ o_constr;
14935 o_constr.datalen = (*env)->GetArrayLength(env, o);
14936 if (o_constr.datalen > 0)
14937 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14939 o_constr.data = NULL;
14940 for (size_t i = 0; i < o_constr.datalen; i++) {
14941 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
14942 LDKSignature o_conv_8_ref;
14943 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
14944 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
14945 o_constr.data[i] = o_conv_8_ref;
14947 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14948 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
14949 return (int64_t)ret_conv;
14952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
14953 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14954 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
14955 return (int64_t)ret_conv;
14958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14959 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
14960 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
14964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14965 if ((_res & 1) != 0) return;
14966 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14967 CHECK_ACCESS(_res_ptr);
14968 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
14970 CResult_CVec_SignatureZNoneZ_free(_res_conv);
14973 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
14974 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14975 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
14976 return (int64_t)ret_conv;
14978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14979 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
14980 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
14984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14985 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
14986 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14987 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
14988 return (int64_t)ret_conv;
14991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14992 LDKShutdownScript o_conv;
14993 o_conv.inner = (void*)(o & (~1));
14994 o_conv.is_owned = (o & 1) || (o == 0);
14995 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14996 o_conv = ShutdownScript_clone(&o_conv);
14997 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14998 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
14999 return (int64_t)ret_conv;
15002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15003 LDKDecodeError e_conv;
15004 e_conv.inner = (void*)(e & (~1));
15005 e_conv.is_owned = (e & 1) || (e == 0);
15006 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15007 e_conv = DecodeError_clone(&e_conv);
15008 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15009 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15010 return (int64_t)ret_conv;
15013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15014 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
15015 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15020 if ((_res & 1) != 0) return;
15021 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15022 CHECK_ACCESS(_res_ptr);
15023 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15025 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15028 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15029 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15030 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15031 return (int64_t)ret_conv;
15033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15034 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
15035 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15040 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
15041 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15042 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15043 return (int64_t)ret_conv;
15046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15047 LDKShutdownScript o_conv;
15048 o_conv.inner = (void*)(o & (~1));
15049 o_conv.is_owned = (o & 1) || (o == 0);
15050 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15051 o_conv = ShutdownScript_clone(&o_conv);
15052 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15053 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15054 return (int64_t)ret_conv;
15057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15058 LDKInvalidShutdownScript e_conv;
15059 e_conv.inner = (void*)(e & (~1));
15060 e_conv.is_owned = (e & 1) || (e == 0);
15061 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15062 e_conv = InvalidShutdownScript_clone(&e_conv);
15063 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15064 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15065 return (int64_t)ret_conv;
15068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15069 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
15070 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15075 if ((_res & 1) != 0) return;
15076 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15077 CHECK_ACCESS(_res_ptr);
15078 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15080 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15083 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15084 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15085 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15086 return (int64_t)ret_conv;
15088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15089 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
15090 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15095 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
15096 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15097 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15098 return (int64_t)ret_conv;
15101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
15102 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15103 *ret_conv = CResult_NoneErrorZ_ok();
15104 return (int64_t)ret_conv;
15107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15108 LDKIOError e_conv = LDKIOError_from_java(env, e);
15109 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15110 *ret_conv = CResult_NoneErrorZ_err(e_conv);
15111 return (int64_t)ret_conv;
15114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15115 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
15116 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
15120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15121 if ((_res & 1) != 0) return;
15122 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15123 CHECK_ACCESS(_res_ptr);
15124 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
15126 CResult_NoneErrorZ_free(_res_conv);
15129 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
15130 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15131 *ret_conv = CResult_NoneErrorZ_clone(arg);
15132 return (int64_t)ret_conv;
15134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15135 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
15136 int64_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
15140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15141 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
15142 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15143 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
15144 return (int64_t)ret_conv;
15147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15148 LDKRouteHop o_conv;
15149 o_conv.inner = (void*)(o & (~1));
15150 o_conv.is_owned = (o & 1) || (o == 0);
15151 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15152 o_conv = RouteHop_clone(&o_conv);
15153 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15154 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
15155 return (int64_t)ret_conv;
15158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15159 LDKDecodeError e_conv;
15160 e_conv.inner = (void*)(e & (~1));
15161 e_conv.is_owned = (e & 1) || (e == 0);
15162 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15163 e_conv = DecodeError_clone(&e_conv);
15164 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15165 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
15166 return (int64_t)ret_conv;
15169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15170 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
15171 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
15175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15176 if ((_res & 1) != 0) return;
15177 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15178 CHECK_ACCESS(_res_ptr);
15179 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
15181 CResult_RouteHopDecodeErrorZ_free(_res_conv);
15184 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
15185 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15186 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
15187 return (int64_t)ret_conv;
15189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15190 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
15191 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
15195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15196 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
15197 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15198 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
15199 return (int64_t)ret_conv;
15202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15203 LDKCVec_RouteHopZ _res_constr;
15204 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15205 if (_res_constr.datalen > 0)
15206 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15208 _res_constr.data = NULL;
15209 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15210 for (size_t k = 0; k < _res_constr.datalen; k++) {
15211 int64_t _res_conv_10 = _res_vals[k];
15212 LDKRouteHop _res_conv_10_conv;
15213 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15214 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15215 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15216 _res_constr.data[k] = _res_conv_10_conv;
15218 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15219 CVec_RouteHopZ_free(_res_constr);
15222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15223 LDKCVec_CVec_RouteHopZZ _res_constr;
15224 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15225 if (_res_constr.datalen > 0)
15226 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15228 _res_constr.data = NULL;
15229 for (size_t m = 0; m < _res_constr.datalen; m++) {
15230 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
15231 LDKCVec_RouteHopZ _res_conv_12_constr;
15232 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
15233 if (_res_conv_12_constr.datalen > 0)
15234 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15236 _res_conv_12_constr.data = NULL;
15237 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
15238 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
15239 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
15240 LDKRouteHop _res_conv_12_conv_10_conv;
15241 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
15242 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
15243 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
15244 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
15246 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
15247 _res_constr.data[m] = _res_conv_12_constr;
15249 CVec_CVec_RouteHopZZ_free(_res_constr);
15252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15254 o_conv.inner = (void*)(o & (~1));
15255 o_conv.is_owned = (o & 1) || (o == 0);
15256 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15257 o_conv = Route_clone(&o_conv);
15258 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15259 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
15260 return (int64_t)ret_conv;
15263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15264 LDKDecodeError e_conv;
15265 e_conv.inner = (void*)(e & (~1));
15266 e_conv.is_owned = (e & 1) || (e == 0);
15267 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15268 e_conv = DecodeError_clone(&e_conv);
15269 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15270 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
15271 return (int64_t)ret_conv;
15274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15275 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
15276 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
15280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15281 if ((_res & 1) != 0) return;
15282 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15283 CHECK_ACCESS(_res_ptr);
15284 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
15286 CResult_RouteDecodeErrorZ_free(_res_conv);
15289 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
15290 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15291 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
15292 return (int64_t)ret_conv;
15294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15295 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
15296 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
15300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15301 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
15302 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15303 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
15304 return (int64_t)ret_conv;
15307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15308 LDKRouteParameters o_conv;
15309 o_conv.inner = (void*)(o & (~1));
15310 o_conv.is_owned = (o & 1) || (o == 0);
15311 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15312 o_conv = RouteParameters_clone(&o_conv);
15313 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15314 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
15315 return (int64_t)ret_conv;
15318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15319 LDKDecodeError e_conv;
15320 e_conv.inner = (void*)(e & (~1));
15321 e_conv.is_owned = (e & 1) || (e == 0);
15322 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15323 e_conv = DecodeError_clone(&e_conv);
15324 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15325 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
15326 return (int64_t)ret_conv;
15329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15330 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
15331 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
15335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15336 if ((_res & 1) != 0) return;
15337 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15338 CHECK_ACCESS(_res_ptr);
15339 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
15341 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
15344 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
15345 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15346 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
15347 return (int64_t)ret_conv;
15349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15350 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
15351 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
15355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15356 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
15357 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15358 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
15359 return (int64_t)ret_conv;
15362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15363 LDKCVec_RouteHintZ _res_constr;
15364 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15365 if (_res_constr.datalen > 0)
15366 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
15368 _res_constr.data = NULL;
15369 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15370 for (size_t l = 0; l < _res_constr.datalen; l++) {
15371 int64_t _res_conv_11 = _res_vals[l];
15372 LDKRouteHint _res_conv_11_conv;
15373 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
15374 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
15375 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
15376 _res_constr.data[l] = _res_conv_11_conv;
15378 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15379 CVec_RouteHintZ_free(_res_constr);
15382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
15383 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15384 *ret_copy = COption_u64Z_some(o);
15385 int64_t ret_ref = (uintptr_t)ret_copy;
15389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
15390 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15391 *ret_copy = COption_u64Z_none();
15392 int64_t ret_ref = (uintptr_t)ret_copy;
15396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15397 if ((_res & 1) != 0) return;
15398 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15399 CHECK_ACCESS(_res_ptr);
15400 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15402 COption_u64Z_free(_res_conv);
15405 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15406 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15407 *ret_copy = COption_u64Z_clone(arg);
15408 int64_t ret_ref = (uintptr_t)ret_copy;
15411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15412 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
15413 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
15417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15418 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
15419 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15420 *ret_copy = COption_u64Z_clone(orig_conv);
15421 int64_t ret_ref = (uintptr_t)ret_copy;
15425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15426 LDKPaymentParameters o_conv;
15427 o_conv.inner = (void*)(o & (~1));
15428 o_conv.is_owned = (o & 1) || (o == 0);
15429 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15430 o_conv = PaymentParameters_clone(&o_conv);
15431 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15432 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
15433 return (int64_t)ret_conv;
15436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15437 LDKDecodeError e_conv;
15438 e_conv.inner = (void*)(e & (~1));
15439 e_conv.is_owned = (e & 1) || (e == 0);
15440 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15441 e_conv = DecodeError_clone(&e_conv);
15442 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15443 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15444 return (int64_t)ret_conv;
15447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15448 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
15449 jboolean ret_val = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15454 if ((_res & 1) != 0) return;
15455 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15456 CHECK_ACCESS(_res_ptr);
15457 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15459 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15462 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15463 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15464 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15465 return (int64_t)ret_conv;
15467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15468 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
15469 int64_t ret_val = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15474 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
15475 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15476 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15477 return (int64_t)ret_conv;
15480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15481 LDKCVec_RouteHintHopZ _res_constr;
15482 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15483 if (_res_constr.datalen > 0)
15484 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15486 _res_constr.data = NULL;
15487 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15488 for (size_t o = 0; o < _res_constr.datalen; o++) {
15489 int64_t _res_conv_14 = _res_vals[o];
15490 LDKRouteHintHop _res_conv_14_conv;
15491 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15492 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15493 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15494 _res_constr.data[o] = _res_conv_14_conv;
15496 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15497 CVec_RouteHintHopZ_free(_res_constr);
15500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15501 LDKRouteHint o_conv;
15502 o_conv.inner = (void*)(o & (~1));
15503 o_conv.is_owned = (o & 1) || (o == 0);
15504 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15505 o_conv = RouteHint_clone(&o_conv);
15506 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15507 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15508 return (int64_t)ret_conv;
15511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15512 LDKDecodeError e_conv;
15513 e_conv.inner = (void*)(e & (~1));
15514 e_conv.is_owned = (e & 1) || (e == 0);
15515 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15516 e_conv = DecodeError_clone(&e_conv);
15517 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15518 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15519 return (int64_t)ret_conv;
15522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15523 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
15524 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15529 if ((_res & 1) != 0) return;
15530 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15531 CHECK_ACCESS(_res_ptr);
15532 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15534 CResult_RouteHintDecodeErrorZ_free(_res_conv);
15537 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15538 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15539 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15540 return (int64_t)ret_conv;
15542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15543 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
15544 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15549 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
15550 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15551 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15552 return (int64_t)ret_conv;
15555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15556 LDKRouteHintHop o_conv;
15557 o_conv.inner = (void*)(o & (~1));
15558 o_conv.is_owned = (o & 1) || (o == 0);
15559 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15560 o_conv = RouteHintHop_clone(&o_conv);
15561 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15562 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15563 return (int64_t)ret_conv;
15566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15567 LDKDecodeError e_conv;
15568 e_conv.inner = (void*)(e & (~1));
15569 e_conv.is_owned = (e & 1) || (e == 0);
15570 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15571 e_conv = DecodeError_clone(&e_conv);
15572 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15573 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15574 return (int64_t)ret_conv;
15577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15578 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
15579 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15584 if ((_res & 1) != 0) return;
15585 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15586 CHECK_ACCESS(_res_ptr);
15587 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15589 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15592 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15593 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15594 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15595 return (int64_t)ret_conv;
15597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15598 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
15599 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15604 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
15605 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15606 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15607 return (int64_t)ret_conv;
15610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15611 LDKCVec_ChannelDetailsZ _res_constr;
15612 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15613 if (_res_constr.datalen > 0)
15614 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15616 _res_constr.data = NULL;
15617 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15618 for (size_t q = 0; q < _res_constr.datalen; q++) {
15619 int64_t _res_conv_16 = _res_vals[q];
15620 LDKChannelDetails _res_conv_16_conv;
15621 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15622 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15623 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15624 _res_constr.data[q] = _res_conv_16_conv;
15626 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15627 CVec_ChannelDetailsZ_free(_res_constr);
15630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15632 o_conv.inner = (void*)(o & (~1));
15633 o_conv.is_owned = (o & 1) || (o == 0);
15634 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15635 o_conv = Route_clone(&o_conv);
15636 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15637 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
15638 return (int64_t)ret_conv;
15641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15642 LDKLightningError e_conv;
15643 e_conv.inner = (void*)(e & (~1));
15644 e_conv.is_owned = (e & 1) || (e == 0);
15645 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15646 e_conv = LightningError_clone(&e_conv);
15647 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15648 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
15649 return (int64_t)ret_conv;
15652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15653 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
15654 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
15658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15659 if ((_res & 1) != 0) return;
15660 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15661 CHECK_ACCESS(_res_ptr);
15662 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
15664 CResult_RouteLightningErrorZ_free(_res_conv);
15667 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
15668 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15669 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
15670 return (int64_t)ret_conv;
15672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15673 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
15674 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
15678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15679 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
15680 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15681 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
15682 return (int64_t)ret_conv;
15685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15686 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15687 CHECK_ACCESS(o_ptr);
15688 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
15689 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
15690 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15691 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
15692 return (int64_t)ret_conv;
15695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15696 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
15697 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15698 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
15699 return (int64_t)ret_conv;
15702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15703 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
15704 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
15708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15709 if ((_res & 1) != 0) return;
15710 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15711 CHECK_ACCESS(_res_ptr);
15712 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
15714 CResult_TxOutAccessErrorZ_free(_res_conv);
15717 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
15718 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15719 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
15720 return (int64_t)ret_conv;
15722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15723 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
15724 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
15728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15729 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
15730 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15731 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
15732 return (int64_t)ret_conv;
15735 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
15736 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15737 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
15738 return ((int64_t)ret_conv);
15740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15741 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
15742 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
15746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15747 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
15748 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15749 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
15750 return ((int64_t)ret_conv);
15753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
15754 LDKTransaction b_ref;
15755 b_ref.datalen = (*env)->GetArrayLength(env, b);
15756 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
15757 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
15758 b_ref.data_is_owned = true;
15759 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15760 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
15761 return ((int64_t)ret_conv);
15764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15765 if ((_res & 1) != 0) return;
15766 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15767 CHECK_ACCESS(_res_ptr);
15768 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
15770 C2Tuple_usizeTransactionZ_free(_res_conv);
15773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15774 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
15775 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15776 if (_res_constr.datalen > 0)
15777 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15779 _res_constr.data = NULL;
15780 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15781 for (size_t c = 0; c < _res_constr.datalen; c++) {
15782 int64_t _res_conv_28 = _res_vals[c];
15783 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
15784 CHECK_ACCESS(_res_conv_28_ptr);
15785 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
15786 FREE((void*)_res_conv_28);
15787 _res_constr.data[c] = _res_conv_28_conv;
15789 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15790 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
15793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15794 LDKCVec_TxidZ _res_constr;
15795 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15796 if (_res_constr.datalen > 0)
15797 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
15799 _res_constr.data = NULL;
15800 for (size_t i = 0; i < _res_constr.datalen; i++) {
15801 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15802 LDKThirtyTwoBytes _res_conv_8_ref;
15803 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
15804 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
15805 _res_constr.data[i] = _res_conv_8_ref;
15807 CVec_TxidZ_free(_res_constr);
15810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
15811 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15812 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
15813 return (int64_t)ret_conv;
15816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
15817 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
15818 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15819 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
15820 return (int64_t)ret_conv;
15823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15824 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
15825 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
15829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15830 if ((_res & 1) != 0) return;
15831 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15832 CHECK_ACCESS(_res_ptr);
15833 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
15835 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
15838 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
15839 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15840 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
15841 return (int64_t)ret_conv;
15843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15844 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
15845 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
15849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15850 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
15851 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15852 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
15853 return (int64_t)ret_conv;
15856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15857 LDKCVec_MonitorEventZ _res_constr;
15858 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15859 if (_res_constr.datalen > 0)
15860 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
15862 _res_constr.data = NULL;
15863 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15864 for (size_t o = 0; o < _res_constr.datalen; o++) {
15865 int64_t _res_conv_14 = _res_vals[o];
15866 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
15867 CHECK_ACCESS(_res_conv_14_ptr);
15868 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
15869 FREE((void*)_res_conv_14);
15870 _res_constr.data[o] = _res_conv_14_conv;
15872 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15873 CVec_MonitorEventZ_free(_res_constr);
15876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15877 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15878 CHECK_ACCESS(o_ptr);
15879 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
15880 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
15881 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15882 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
15883 int64_t ret_ref = (uintptr_t)ret_copy;
15887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
15888 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15889 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
15890 int64_t ret_ref = (uintptr_t)ret_copy;
15894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15895 if ((_res & 1) != 0) return;
15896 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15897 CHECK_ACCESS(_res_ptr);
15898 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
15900 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
15903 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
15904 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15905 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
15906 int64_t ret_ref = (uintptr_t)ret_copy;
15909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15910 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
15911 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
15915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15916 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
15917 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15918 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
15919 int64_t ret_ref = (uintptr_t)ret_copy;
15923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15924 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15925 CHECK_ACCESS(o_ptr);
15926 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
15927 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
15928 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15929 *ret_copy = COption_ClosureReasonZ_some(o_conv);
15930 int64_t ret_ref = (uintptr_t)ret_copy;
15934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
15935 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15936 *ret_copy = COption_ClosureReasonZ_none();
15937 int64_t ret_ref = (uintptr_t)ret_copy;
15941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15942 if ((_res & 1) != 0) return;
15943 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15944 CHECK_ACCESS(_res_ptr);
15945 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
15947 COption_ClosureReasonZ_free(_res_conv);
15950 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
15951 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15952 *ret_copy = COption_ClosureReasonZ_clone(arg);
15953 int64_t ret_ref = (uintptr_t)ret_copy;
15956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15957 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
15958 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
15962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15963 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
15964 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15965 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
15966 int64_t ret_ref = (uintptr_t)ret_copy;
15970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15971 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15972 CHECK_ACCESS(o_ptr);
15973 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
15974 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
15975 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15976 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
15977 return (int64_t)ret_conv;
15980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15981 LDKDecodeError e_conv;
15982 e_conv.inner = (void*)(e & (~1));
15983 e_conv.is_owned = (e & 1) || (e == 0);
15984 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15985 e_conv = DecodeError_clone(&e_conv);
15986 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15987 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
15988 return (int64_t)ret_conv;
15991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15992 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
15993 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
15997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15998 if ((_res & 1) != 0) return;
15999 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16000 CHECK_ACCESS(_res_ptr);
16001 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
16003 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
16006 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
16007 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16008 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
16009 return (int64_t)ret_conv;
16011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16012 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
16013 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
16017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16018 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
16019 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16020 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
16021 return (int64_t)ret_conv;
16024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16025 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16026 CHECK_ACCESS(o_ptr);
16027 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
16028 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
16029 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16030 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
16031 int64_t ret_ref = (uintptr_t)ret_copy;
16035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
16036 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16037 *ret_copy = COption_NetworkUpdateZ_none();
16038 int64_t ret_ref = (uintptr_t)ret_copy;
16042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16043 if ((_res & 1) != 0) return;
16044 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16045 CHECK_ACCESS(_res_ptr);
16046 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
16048 COption_NetworkUpdateZ_free(_res_conv);
16051 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
16052 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16053 *ret_copy = COption_NetworkUpdateZ_clone(arg);
16054 int64_t ret_ref = (uintptr_t)ret_copy;
16057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16058 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
16059 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
16063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16064 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
16065 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16066 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
16067 int64_t ret_ref = (uintptr_t)ret_copy;
16071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16072 LDKCVec_SpendableOutputDescriptorZ _res_constr;
16073 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16074 if (_res_constr.datalen > 0)
16075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16077 _res_constr.data = NULL;
16078 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16079 for (size_t b = 0; b < _res_constr.datalen; b++) {
16080 int64_t _res_conv_27 = _res_vals[b];
16081 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
16082 CHECK_ACCESS(_res_conv_27_ptr);
16083 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16084 FREE((void*)_res_conv_27);
16085 _res_constr.data[b] = _res_conv_27_conv;
16087 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16088 CVec_SpendableOutputDescriptorZ_free(_res_constr);
16091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16092 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16093 CHECK_ACCESS(o_ptr);
16094 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
16095 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
16096 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16097 *ret_copy = COption_EventZ_some(o_conv);
16098 int64_t ret_ref = (uintptr_t)ret_copy;
16102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
16103 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16104 *ret_copy = COption_EventZ_none();
16105 int64_t ret_ref = (uintptr_t)ret_copy;
16109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_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 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
16115 COption_EventZ_free(_res_conv);
16118 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
16119 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16120 *ret_copy = COption_EventZ_clone(arg);
16121 int64_t ret_ref = (uintptr_t)ret_copy;
16124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16125 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
16126 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
16130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16131 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
16132 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16133 *ret_copy = COption_EventZ_clone(orig_conv);
16134 int64_t ret_ref = (uintptr_t)ret_copy;
16138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16139 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16140 CHECK_ACCESS(o_ptr);
16141 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
16142 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
16143 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16144 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
16145 return (int64_t)ret_conv;
16148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16149 LDKDecodeError e_conv;
16150 e_conv.inner = (void*)(e & (~1));
16151 e_conv.is_owned = (e & 1) || (e == 0);
16152 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16153 e_conv = DecodeError_clone(&e_conv);
16154 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16155 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
16156 return (int64_t)ret_conv;
16159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16160 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
16161 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
16165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16166 if ((_res & 1) != 0) return;
16167 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16168 CHECK_ACCESS(_res_ptr);
16169 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
16171 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
16174 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
16175 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16176 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
16177 return (int64_t)ret_conv;
16179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16180 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
16181 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
16185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16186 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
16187 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16188 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
16189 return (int64_t)ret_conv;
16192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16193 LDKCVec_MessageSendEventZ _res_constr;
16194 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16195 if (_res_constr.datalen > 0)
16196 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16198 _res_constr.data = NULL;
16199 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16200 for (size_t s = 0; s < _res_constr.datalen; s++) {
16201 int64_t _res_conv_18 = _res_vals[s];
16202 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
16203 CHECK_ACCESS(_res_conv_18_ptr);
16204 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
16205 FREE((void*)_res_conv_18);
16206 _res_constr.data[s] = _res_conv_18_conv;
16208 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16209 CVec_MessageSendEventZ_free(_res_constr);
16212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16213 LDKFixedPenaltyScorer o_conv;
16214 o_conv.inner = (void*)(o & (~1));
16215 o_conv.is_owned = (o & 1) || (o == 0);
16216 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16217 o_conv = FixedPenaltyScorer_clone(&o_conv);
16218 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16219 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
16220 return (int64_t)ret_conv;
16223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16224 LDKDecodeError e_conv;
16225 e_conv.inner = (void*)(e & (~1));
16226 e_conv.is_owned = (e & 1) || (e == 0);
16227 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16228 e_conv = DecodeError_clone(&e_conv);
16229 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16230 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
16231 return (int64_t)ret_conv;
16234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16235 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
16236 jboolean ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
16240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16241 if ((_res & 1) != 0) return;
16242 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16243 CHECK_ACCESS(_res_ptr);
16244 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
16246 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
16249 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
16250 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16251 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
16252 return (int64_t)ret_conv;
16254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16255 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
16256 int64_t ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
16260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16261 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
16262 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16263 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
16264 return (int64_t)ret_conv;
16267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16268 LDKScoringParameters o_conv;
16269 o_conv.inner = (void*)(o & (~1));
16270 o_conv.is_owned = (o & 1) || (o == 0);
16271 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16272 o_conv = ScoringParameters_clone(&o_conv);
16273 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16274 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
16275 return (int64_t)ret_conv;
16278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16279 LDKDecodeError e_conv;
16280 e_conv.inner = (void*)(e & (~1));
16281 e_conv.is_owned = (e & 1) || (e == 0);
16282 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16283 e_conv = DecodeError_clone(&e_conv);
16284 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16285 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
16286 return (int64_t)ret_conv;
16289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16290 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
16291 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
16295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16296 if ((_res & 1) != 0) return;
16297 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16298 CHECK_ACCESS(_res_ptr);
16299 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
16301 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
16304 static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
16305 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16306 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg);
16307 return (int64_t)ret_conv;
16309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16310 LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
16311 int64_t ret_val = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
16315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16316 LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1);
16317 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16318 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv);
16319 return (int64_t)ret_conv;
16322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16324 o_conv.inner = (void*)(o & (~1));
16325 o_conv.is_owned = (o & 1) || (o == 0);
16326 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16327 // WARNING: we need a move here but no clone is available for LDKScorer
16328 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
16329 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
16330 return (int64_t)ret_conv;
16333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16334 LDKDecodeError e_conv;
16335 e_conv.inner = (void*)(e & (~1));
16336 e_conv.is_owned = (e & 1) || (e == 0);
16337 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16338 e_conv = DecodeError_clone(&e_conv);
16339 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
16340 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
16341 return (int64_t)ret_conv;
16344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16345 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
16346 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
16350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16351 if ((_res & 1) != 0) return;
16352 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16353 CHECK_ACCESS(_res_ptr);
16354 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
16356 CResult_ScorerDecodeErrorZ_free(_res_conv);
16359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16360 LDKProbabilisticScorer o_conv;
16361 o_conv.inner = (void*)(o & (~1));
16362 o_conv.is_owned = (o & 1) || (o == 0);
16363 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16364 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16365 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16366 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16367 return (int64_t)ret_conv;
16370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16371 LDKDecodeError e_conv;
16372 e_conv.inner = (void*)(e & (~1));
16373 e_conv.is_owned = (e & 1) || (e == 0);
16374 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16375 e_conv = DecodeError_clone(&e_conv);
16376 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16377 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16378 return (int64_t)ret_conv;
16381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16382 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
16383 jboolean ret_val = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
16387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16388 if ((_res & 1) != 0) return;
16389 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16390 CHECK_ACCESS(_res_ptr);
16391 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
16393 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
16396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16397 LDKInitFeatures o_conv;
16398 o_conv.inner = (void*)(o & (~1));
16399 o_conv.is_owned = (o & 1) || (o == 0);
16400 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16401 o_conv = InitFeatures_clone(&o_conv);
16402 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16403 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
16404 return (int64_t)ret_conv;
16407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16408 LDKDecodeError e_conv;
16409 e_conv.inner = (void*)(e & (~1));
16410 e_conv.is_owned = (e & 1) || (e == 0);
16411 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16412 e_conv = DecodeError_clone(&e_conv);
16413 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16414 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
16415 return (int64_t)ret_conv;
16418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16419 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
16420 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16425 if ((_res & 1) != 0) return;
16426 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16427 CHECK_ACCESS(_res_ptr);
16428 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16430 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16434 LDKChannelFeatures o_conv;
16435 o_conv.inner = (void*)(o & (~1));
16436 o_conv.is_owned = (o & 1) || (o == 0);
16437 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16438 o_conv = ChannelFeatures_clone(&o_conv);
16439 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16440 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16441 return (int64_t)ret_conv;
16444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16445 LDKDecodeError e_conv;
16446 e_conv.inner = (void*)(e & (~1));
16447 e_conv.is_owned = (e & 1) || (e == 0);
16448 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16449 e_conv = DecodeError_clone(&e_conv);
16450 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16451 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16452 return (int64_t)ret_conv;
16455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16456 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
16457 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16462 if ((_res & 1) != 0) return;
16463 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16464 CHECK_ACCESS(_res_ptr);
16465 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16467 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16471 LDKNodeFeatures o_conv;
16472 o_conv.inner = (void*)(o & (~1));
16473 o_conv.is_owned = (o & 1) || (o == 0);
16474 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16475 o_conv = NodeFeatures_clone(&o_conv);
16476 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16477 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16478 return (int64_t)ret_conv;
16481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16482 LDKDecodeError e_conv;
16483 e_conv.inner = (void*)(e & (~1));
16484 e_conv.is_owned = (e & 1) || (e == 0);
16485 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16486 e_conv = DecodeError_clone(&e_conv);
16487 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16488 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16489 return (int64_t)ret_conv;
16492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16493 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
16494 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16499 if ((_res & 1) != 0) return;
16500 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16501 CHECK_ACCESS(_res_ptr);
16502 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16504 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16508 LDKInvoiceFeatures o_conv;
16509 o_conv.inner = (void*)(o & (~1));
16510 o_conv.is_owned = (o & 1) || (o == 0);
16511 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16512 o_conv = InvoiceFeatures_clone(&o_conv);
16513 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16514 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16515 return (int64_t)ret_conv;
16518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16519 LDKDecodeError e_conv;
16520 e_conv.inner = (void*)(e & (~1));
16521 e_conv.is_owned = (e & 1) || (e == 0);
16522 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16523 e_conv = DecodeError_clone(&e_conv);
16524 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16525 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
16526 return (int64_t)ret_conv;
16529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16530 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
16531 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
16535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16536 if ((_res & 1) != 0) return;
16537 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16538 CHECK_ACCESS(_res_ptr);
16539 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
16541 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
16544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16545 LDKChannelTypeFeatures o_conv;
16546 o_conv.inner = (void*)(o & (~1));
16547 o_conv.is_owned = (o & 1) || (o == 0);
16548 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16549 o_conv = ChannelTypeFeatures_clone(&o_conv);
16550 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16551 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
16552 return (int64_t)ret_conv;
16555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16556 LDKDecodeError e_conv;
16557 e_conv.inner = (void*)(e & (~1));
16558 e_conv.is_owned = (e & 1) || (e == 0);
16559 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16560 e_conv = DecodeError_clone(&e_conv);
16561 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16562 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
16563 return (int64_t)ret_conv;
16566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16567 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
16568 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
16572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16573 if ((_res & 1) != 0) return;
16574 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16575 CHECK_ACCESS(_res_ptr);
16576 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
16578 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
16581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16582 LDKDelayedPaymentOutputDescriptor o_conv;
16583 o_conv.inner = (void*)(o & (~1));
16584 o_conv.is_owned = (o & 1) || (o == 0);
16585 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16586 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16587 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16588 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16589 return (int64_t)ret_conv;
16592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16593 LDKDecodeError e_conv;
16594 e_conv.inner = (void*)(e & (~1));
16595 e_conv.is_owned = (e & 1) || (e == 0);
16596 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16597 e_conv = DecodeError_clone(&e_conv);
16598 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16599 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16600 return (int64_t)ret_conv;
16603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16604 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16605 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16610 if ((_res & 1) != 0) return;
16611 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16612 CHECK_ACCESS(_res_ptr);
16613 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16615 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16618 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16619 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16620 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16621 return (int64_t)ret_conv;
16623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16624 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16625 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16630 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16631 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16632 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16633 return (int64_t)ret_conv;
16636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16637 LDKStaticPaymentOutputDescriptor o_conv;
16638 o_conv.inner = (void*)(o & (~1));
16639 o_conv.is_owned = (o & 1) || (o == 0);
16640 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16641 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16642 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16643 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16644 return (int64_t)ret_conv;
16647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16648 LDKDecodeError e_conv;
16649 e_conv.inner = (void*)(e & (~1));
16650 e_conv.is_owned = (e & 1) || (e == 0);
16651 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16652 e_conv = DecodeError_clone(&e_conv);
16653 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16654 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16655 return (int64_t)ret_conv;
16658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16659 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16660 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16665 if ((_res & 1) != 0) return;
16666 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16667 CHECK_ACCESS(_res_ptr);
16668 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16670 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16673 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16674 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16675 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16676 return (int64_t)ret_conv;
16678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16679 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16680 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16685 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16686 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16687 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16688 return (int64_t)ret_conv;
16691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16692 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16693 CHECK_ACCESS(o_ptr);
16694 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16695 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
16696 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16697 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16698 return (int64_t)ret_conv;
16701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16702 LDKDecodeError e_conv;
16703 e_conv.inner = (void*)(e & (~1));
16704 e_conv.is_owned = (e & 1) || (e == 0);
16705 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16706 e_conv = DecodeError_clone(&e_conv);
16707 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16708 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16709 return (int64_t)ret_conv;
16712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16713 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
16714 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16719 if ((_res & 1) != 0) return;
16720 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16721 CHECK_ACCESS(_res_ptr);
16722 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16724 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16727 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16728 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16729 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16730 return (int64_t)ret_conv;
16732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16733 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
16734 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16739 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
16740 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16741 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16742 return (int64_t)ret_conv;
16745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16746 LDKCVec_PaymentPreimageZ _res_constr;
16747 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16748 if (_res_constr.datalen > 0)
16749 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16751 _res_constr.data = NULL;
16752 for (size_t i = 0; i < _res_constr.datalen; i++) {
16753 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16754 LDKThirtyTwoBytes _res_conv_8_ref;
16755 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
16756 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
16757 _res_constr.data[i] = _res_conv_8_ref;
16759 CVec_PaymentPreimageZ_free(_res_constr);
16762 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16763 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16764 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16765 return ((int64_t)ret_conv);
16767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16768 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
16769 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16774 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
16775 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16776 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16777 return ((int64_t)ret_conv);
16780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
16781 LDKSignature a_ref;
16782 CHECK((*env)->GetArrayLength(env, a) == 64);
16783 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16784 LDKCVec_SignatureZ b_constr;
16785 b_constr.datalen = (*env)->GetArrayLength(env, b);
16786 if (b_constr.datalen > 0)
16787 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16789 b_constr.data = NULL;
16790 for (size_t i = 0; i < b_constr.datalen; i++) {
16791 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
16792 LDKSignature b_conv_8_ref;
16793 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
16794 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
16795 b_constr.data[i] = b_conv_8_ref;
16797 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16798 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16799 return ((int64_t)ret_conv);
16802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16803 if ((_res & 1) != 0) return;
16804 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16805 CHECK_ACCESS(_res_ptr);
16806 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16808 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16812 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16813 CHECK_ACCESS(o_ptr);
16814 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16815 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
16816 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16817 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16818 return (int64_t)ret_conv;
16821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
16822 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16823 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16824 return (int64_t)ret_conv;
16827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16828 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
16829 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16834 if ((_res & 1) != 0) return;
16835 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16836 CHECK_ACCESS(_res_ptr);
16837 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16839 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16842 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16843 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16844 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16845 return (int64_t)ret_conv;
16847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16848 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
16849 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16854 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
16855 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16856 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16857 return (int64_t)ret_conv;
16860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16861 LDKSignature o_ref;
16862 CHECK((*env)->GetArrayLength(env, o) == 64);
16863 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
16864 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16865 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16866 return (int64_t)ret_conv;
16869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
16870 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16871 *ret_conv = CResult_SignatureNoneZ_err();
16872 return (int64_t)ret_conv;
16875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16876 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
16877 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
16881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16882 if ((_res & 1) != 0) return;
16883 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16884 CHECK_ACCESS(_res_ptr);
16885 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16887 CResult_SignatureNoneZ_free(_res_conv);
16890 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16891 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16892 *ret_conv = CResult_SignatureNoneZ_clone(arg);
16893 return (int64_t)ret_conv;
16895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16896 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
16897 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16902 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
16903 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16904 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16905 return (int64_t)ret_conv;
16908 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
16909 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16910 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
16911 return ((int64_t)ret_conv);
16913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16914 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
16915 int64_t ret_val = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
16919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16920 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
16921 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16922 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
16923 return ((int64_t)ret_conv);
16926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
16927 LDKSignature a_ref;
16928 CHECK((*env)->GetArrayLength(env, a) == 64);
16929 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16930 LDKSignature b_ref;
16931 CHECK((*env)->GetArrayLength(env, b) == 64);
16932 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
16933 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16934 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
16935 return ((int64_t)ret_conv);
16938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16939 if ((_res & 1) != 0) return;
16940 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16941 CHECK_ACCESS(_res_ptr);
16942 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
16944 C2Tuple_SignatureSignatureZ_free(_res_conv);
16947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16948 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16949 CHECK_ACCESS(o_ptr);
16950 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
16951 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
16952 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16953 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
16954 return (int64_t)ret_conv;
16957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
16958 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16959 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
16960 return (int64_t)ret_conv;
16963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16964 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
16965 jboolean ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
16969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16970 if ((_res & 1) != 0) return;
16971 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16972 CHECK_ACCESS(_res_ptr);
16973 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
16975 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
16978 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
16979 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16980 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
16981 return (int64_t)ret_conv;
16983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16984 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
16985 int64_t ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
16989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16990 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
16991 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16992 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
16993 return (int64_t)ret_conv;
16996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16997 LDKSecretKey o_ref;
16998 CHECK((*env)->GetArrayLength(env, o) == 32);
16999 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
17000 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17001 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
17002 return (int64_t)ret_conv;
17005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
17006 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17007 *ret_conv = CResult_SecretKeyNoneZ_err();
17008 return (int64_t)ret_conv;
17011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17012 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
17013 jboolean ret_val = CResult_SecretKeyNoneZ_is_ok(o_conv);
17017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17018 if ((_res & 1) != 0) return;
17019 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17020 CHECK_ACCESS(_res_ptr);
17021 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
17023 CResult_SecretKeyNoneZ_free(_res_conv);
17026 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
17027 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17028 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
17029 return (int64_t)ret_conv;
17031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17032 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
17033 int64_t ret_val = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
17037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17038 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
17039 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17040 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
17041 return (int64_t)ret_conv;
17044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17045 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17046 CHECK_ACCESS(o_ptr);
17047 LDKSign o_conv = *(LDKSign*)(o_ptr);
17048 if (o_conv.free == LDKSign_JCalls_free) {
17049 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17050 LDKSign_JCalls_cloned(&o_conv);
17052 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17053 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
17054 return (int64_t)ret_conv;
17057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17058 LDKDecodeError e_conv;
17059 e_conv.inner = (void*)(e & (~1));
17060 e_conv.is_owned = (e & 1) || (e == 0);
17061 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17062 e_conv = DecodeError_clone(&e_conv);
17063 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17064 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
17065 return (int64_t)ret_conv;
17068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17069 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
17070 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
17074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17075 if ((_res & 1) != 0) return;
17076 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17077 CHECK_ACCESS(_res_ptr);
17078 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
17080 CResult_SignDecodeErrorZ_free(_res_conv);
17083 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
17084 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17085 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
17086 return (int64_t)ret_conv;
17088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17089 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
17090 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
17094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17095 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
17096 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17097 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
17098 return (int64_t)ret_conv;
17101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17102 LDKCVec_u5Z _res_constr;
17103 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17104 if (_res_constr.datalen > 0)
17105 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
17107 _res_constr.data = NULL;
17108 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
17109 for (size_t h = 0; h < _res_constr.datalen; h++) {
17110 int8_t _res_conv_7 = _res_vals[h];
17112 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
17114 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
17115 CVec_u5Z_free(_res_constr);
17118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17119 LDKRecoverableSignature o_ref;
17120 CHECK((*env)->GetArrayLength(env, o) == 68);
17121 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
17122 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17123 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
17124 return (int64_t)ret_conv;
17127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17128 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17129 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
17130 return (int64_t)ret_conv;
17133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17134 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
17135 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
17139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17140 if ((_res & 1) != 0) return;
17141 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17142 CHECK_ACCESS(_res_ptr);
17143 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
17145 CResult_RecoverableSignatureNoneZ_free(_res_conv);
17148 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
17149 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17150 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
17151 return (int64_t)ret_conv;
17153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17154 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
17155 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
17159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17160 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
17161 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17162 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
17163 return (int64_t)ret_conv;
17166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
17167 LDKCVec_u8Z _res_ref;
17168 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
17169 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
17170 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
17171 CVec_u8Z_free(_res_ref);
17174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17175 LDKCVec_CVec_u8ZZ _res_constr;
17176 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17177 if (_res_constr.datalen > 0)
17178 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17180 _res_constr.data = NULL;
17181 for (size_t i = 0; i < _res_constr.datalen; i++) {
17182 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17183 LDKCVec_u8Z _res_conv_8_ref;
17184 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
17185 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
17186 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
17187 _res_constr.data[i] = _res_conv_8_ref;
17189 CVec_CVec_u8ZZ_free(_res_constr);
17192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
17193 LDKCVec_CVec_u8ZZ o_constr;
17194 o_constr.datalen = (*env)->GetArrayLength(env, o);
17195 if (o_constr.datalen > 0)
17196 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17198 o_constr.data = NULL;
17199 for (size_t i = 0; i < o_constr.datalen; i++) {
17200 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
17201 LDKCVec_u8Z o_conv_8_ref;
17202 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
17203 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
17204 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
17205 o_constr.data[i] = o_conv_8_ref;
17207 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17208 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
17209 return (int64_t)ret_conv;
17212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
17213 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17214 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
17215 return (int64_t)ret_conv;
17218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17219 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
17220 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
17224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17225 if ((_res & 1) != 0) return;
17226 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17227 CHECK_ACCESS(_res_ptr);
17228 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
17230 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
17233 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
17234 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17235 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
17236 return (int64_t)ret_conv;
17238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17239 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
17240 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
17244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17245 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
17246 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17247 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
17248 return (int64_t)ret_conv;
17251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17252 LDKInMemorySigner o_conv;
17253 o_conv.inner = (void*)(o & (~1));
17254 o_conv.is_owned = (o & 1) || (o == 0);
17255 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17256 o_conv = InMemorySigner_clone(&o_conv);
17257 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17258 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
17259 return (int64_t)ret_conv;
17262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17263 LDKDecodeError e_conv;
17264 e_conv.inner = (void*)(e & (~1));
17265 e_conv.is_owned = (e & 1) || (e == 0);
17266 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17267 e_conv = DecodeError_clone(&e_conv);
17268 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17269 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
17270 return (int64_t)ret_conv;
17273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17274 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
17275 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
17279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17280 if ((_res & 1) != 0) return;
17281 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17282 CHECK_ACCESS(_res_ptr);
17283 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
17285 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
17288 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
17289 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17290 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
17291 return (int64_t)ret_conv;
17293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17294 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
17295 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
17299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17300 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
17301 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17302 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
17303 return (int64_t)ret_conv;
17306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17307 LDKCVec_TxOutZ _res_constr;
17308 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17309 if (_res_constr.datalen > 0)
17310 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17312 _res_constr.data = NULL;
17313 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17314 for (size_t h = 0; h < _res_constr.datalen; h++) {
17315 int64_t _res_conv_7 = _res_vals[h];
17316 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
17317 CHECK_ACCESS(_res_conv_7_ptr);
17318 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17319 FREE((void*)_res_conv_7);
17320 _res_constr.data[h] = _res_conv_7_conv;
17322 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17323 CVec_TxOutZ_free(_res_constr);
17326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17327 LDKTransaction o_ref;
17328 o_ref.datalen = (*env)->GetArrayLength(env, o);
17329 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
17330 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
17331 o_ref.data_is_owned = true;
17332 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17333 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
17334 return (int64_t)ret_conv;
17337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
17338 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17339 *ret_conv = CResult_TransactionNoneZ_err();
17340 return (int64_t)ret_conv;
17343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17344 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
17345 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
17349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17350 if ((_res & 1) != 0) return;
17351 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17352 CHECK_ACCESS(_res_ptr);
17353 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17355 CResult_TransactionNoneZ_free(_res_conv);
17358 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17359 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17360 *ret_conv = CResult_TransactionNoneZ_clone(arg);
17361 return (int64_t)ret_conv;
17363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17364 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
17365 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17370 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
17371 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17372 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17373 return (int64_t)ret_conv;
17376 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
17377 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17378 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
17379 return ((int64_t)ret_conv);
17381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17382 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
17383 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
17387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17388 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
17389 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17390 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
17391 return ((int64_t)ret_conv);
17394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
17395 LDKThirtyTwoBytes a_ref;
17396 CHECK((*env)->GetArrayLength(env, a) == 32);
17397 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17398 LDKChannelMonitor b_conv;
17399 b_conv.inner = (void*)(b & (~1));
17400 b_conv.is_owned = (b & 1) || (b == 0);
17401 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17402 b_conv = ChannelMonitor_clone(&b_conv);
17403 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17404 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
17405 return ((int64_t)ret_conv);
17408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17409 if ((_res & 1) != 0) return;
17410 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17411 CHECK_ACCESS(_res_ptr);
17412 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
17414 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
17417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17418 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
17419 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17420 if (_res_constr.datalen > 0)
17421 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
17423 _res_constr.data = NULL;
17424 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17425 for (size_t j = 0; j < _res_constr.datalen; j++) {
17426 int64_t _res_conv_35 = _res_vals[j];
17427 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
17428 CHECK_ACCESS(_res_conv_35_ptr);
17429 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
17430 FREE((void*)_res_conv_35);
17431 _res_constr.data[j] = _res_conv_35_conv;
17433 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17434 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
17437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
17438 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
17439 o_constr.datalen = (*env)->GetArrayLength(env, o);
17440 if (o_constr.datalen > 0)
17441 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
17443 o_constr.data = NULL;
17444 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17445 for (size_t j = 0; j < o_constr.datalen; j++) {
17446 int64_t o_conv_35 = o_vals[j];
17447 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
17448 CHECK_ACCESS(o_conv_35_ptr);
17449 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
17450 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
17451 o_constr.data[j] = o_conv_35_conv;
17453 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17454 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17455 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
17456 return (int64_t)ret_conv;
17459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17460 LDKIOError e_conv = LDKIOError_from_java(env, e);
17461 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17462 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
17463 return (int64_t)ret_conv;
17466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17467 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
17468 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
17472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17473 if ((_res & 1) != 0) return;
17474 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17475 CHECK_ACCESS(_res_ptr);
17476 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
17478 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
17481 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
17482 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17483 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
17484 return (int64_t)ret_conv;
17486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17487 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
17488 int64_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
17492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17493 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
17494 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17495 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
17496 return (int64_t)ret_conv;
17499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
17500 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17501 *ret_copy = COption_u16Z_some(o);
17502 int64_t ret_ref = (uintptr_t)ret_copy;
17506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
17507 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17508 *ret_copy = COption_u16Z_none();
17509 int64_t ret_ref = (uintptr_t)ret_copy;
17513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17514 if ((_res & 1) != 0) return;
17515 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17516 CHECK_ACCESS(_res_ptr);
17517 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17519 COption_u16Z_free(_res_conv);
17522 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17523 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17524 *ret_copy = COption_u16Z_clone(arg);
17525 int64_t ret_ref = (uintptr_t)ret_copy;
17528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17529 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
17530 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
17534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17535 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
17536 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17537 *ret_copy = COption_u16Z_clone(orig_conv);
17538 int64_t ret_ref = (uintptr_t)ret_copy;
17542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
17543 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17544 *ret_conv = CResult_NoneAPIErrorZ_ok();
17545 return (int64_t)ret_conv;
17548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17549 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17550 CHECK_ACCESS(e_ptr);
17551 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17552 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17553 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17554 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
17555 return (int64_t)ret_conv;
17558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17559 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
17560 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
17564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17565 if ((_res & 1) != 0) return;
17566 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17567 CHECK_ACCESS(_res_ptr);
17568 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
17570 CResult_NoneAPIErrorZ_free(_res_conv);
17573 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
17574 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17575 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
17576 return (int64_t)ret_conv;
17578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17579 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
17580 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
17584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17585 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
17586 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17587 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
17588 return (int64_t)ret_conv;
17591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17592 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
17593 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17594 if (_res_constr.datalen > 0)
17595 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17597 _res_constr.data = NULL;
17598 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17599 for (size_t w = 0; w < _res_constr.datalen; w++) {
17600 int64_t _res_conv_22 = _res_vals[w];
17601 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
17602 CHECK_ACCESS(_res_conv_22_ptr);
17603 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
17604 FREE((void*)_res_conv_22);
17605 _res_constr.data[w] = _res_conv_22_conv;
17607 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17608 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
17611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17612 LDKCVec_APIErrorZ _res_constr;
17613 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17614 if (_res_constr.datalen > 0)
17615 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17617 _res_constr.data = NULL;
17618 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17619 for (size_t k = 0; k < _res_constr.datalen; k++) {
17620 int64_t _res_conv_10 = _res_vals[k];
17621 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
17622 CHECK_ACCESS(_res_conv_10_ptr);
17623 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
17624 FREE((void*)_res_conv_10);
17625 _res_constr.data[k] = _res_conv_10_conv;
17627 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17628 CVec_APIErrorZ_free(_res_constr);
17631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17632 LDKThirtyTwoBytes o_ref;
17633 CHECK((*env)->GetArrayLength(env, o) == 32);
17634 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17635 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17636 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17637 return (int64_t)ret_conv;
17640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17641 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17642 CHECK_ACCESS(e_ptr);
17643 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17644 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17645 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17646 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17647 return (int64_t)ret_conv;
17650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17651 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
17652 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
17656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17657 if ((_res & 1) != 0) return;
17658 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17659 CHECK_ACCESS(_res_ptr);
17660 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17662 CResult__u832APIErrorZ_free(_res_conv);
17665 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17666 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17667 *ret_conv = CResult__u832APIErrorZ_clone(arg);
17668 return (int64_t)ret_conv;
17670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17671 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
17672 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17677 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
17678 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17679 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17680 return (int64_t)ret_conv;
17683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17684 LDKThirtyTwoBytes o_ref;
17685 CHECK((*env)->GetArrayLength(env, o) == 32);
17686 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17687 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17688 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
17689 return (int64_t)ret_conv;
17692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17693 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17694 CHECK_ACCESS(e_ptr);
17695 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17696 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17697 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17698 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
17699 return (int64_t)ret_conv;
17702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17703 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
17704 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
17708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17709 if ((_res & 1) != 0) return;
17710 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17711 CHECK_ACCESS(_res_ptr);
17712 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
17714 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
17717 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
17718 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17719 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
17720 return (int64_t)ret_conv;
17722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17723 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
17724 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
17728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17729 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
17730 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17731 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
17732 return (int64_t)ret_conv;
17735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
17736 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17737 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17738 return (int64_t)ret_conv;
17741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17742 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17743 CHECK_ACCESS(e_ptr);
17744 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17745 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17746 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17747 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17748 return (int64_t)ret_conv;
17751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17752 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
17753 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17758 if ((_res & 1) != 0) return;
17759 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17760 CHECK_ACCESS(_res_ptr);
17761 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17763 CResult_NonePaymentSendFailureZ_free(_res_conv);
17766 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17767 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17768 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17769 return (int64_t)ret_conv;
17771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17772 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
17773 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17778 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
17779 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17780 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17781 return (int64_t)ret_conv;
17784 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17785 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17786 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17787 return ((int64_t)ret_conv);
17789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17790 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
17791 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17796 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
17797 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17798 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17799 return ((int64_t)ret_conv);
17802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17803 LDKThirtyTwoBytes a_ref;
17804 CHECK((*env)->GetArrayLength(env, a) == 32);
17805 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17806 LDKThirtyTwoBytes b_ref;
17807 CHECK((*env)->GetArrayLength(env, b) == 32);
17808 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17809 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17810 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17811 return ((int64_t)ret_conv);
17814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17815 if ((_res & 1) != 0) return;
17816 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17817 CHECK_ACCESS(_res_ptr);
17818 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17820 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17824 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17825 CHECK_ACCESS(o_ptr);
17826 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17827 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
17828 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17829 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17830 return (int64_t)ret_conv;
17833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17834 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17835 CHECK_ACCESS(e_ptr);
17836 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17837 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17838 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17839 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17840 return (int64_t)ret_conv;
17843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17844 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
17845 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17850 if ((_res & 1) != 0) return;
17851 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17852 CHECK_ACCESS(_res_ptr);
17853 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17855 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17858 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17859 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17860 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17861 return (int64_t)ret_conv;
17863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17864 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
17865 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17870 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
17871 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17872 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17873 return (int64_t)ret_conv;
17876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17877 LDKCVec_NetAddressZ _res_constr;
17878 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17879 if (_res_constr.datalen > 0)
17880 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17882 _res_constr.data = NULL;
17883 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17884 for (size_t m = 0; m < _res_constr.datalen; m++) {
17885 int64_t _res_conv_12 = _res_vals[m];
17886 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
17887 CHECK_ACCESS(_res_conv_12_ptr);
17888 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17889 FREE((void*)_res_conv_12);
17890 _res_constr.data[m] = _res_conv_12_conv;
17892 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17893 CVec_NetAddressZ_free(_res_constr);
17896 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17897 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17898 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17899 return ((int64_t)ret_conv);
17901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17902 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
17903 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17908 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
17909 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17910 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17911 return ((int64_t)ret_conv);
17914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17915 LDKThirtyTwoBytes a_ref;
17916 CHECK((*env)->GetArrayLength(env, a) == 32);
17917 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17918 LDKThirtyTwoBytes b_ref;
17919 CHECK((*env)->GetArrayLength(env, b) == 32);
17920 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17921 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17922 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17923 return ((int64_t)ret_conv);
17926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17927 if ((_res & 1) != 0) return;
17928 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17929 CHECK_ACCESS(_res_ptr);
17930 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17932 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17936 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17937 CHECK_ACCESS(o_ptr);
17938 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17939 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
17940 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17941 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
17942 return (int64_t)ret_conv;
17945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
17946 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17947 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
17948 return (int64_t)ret_conv;
17951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17952 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
17953 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
17957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17958 if ((_res & 1) != 0) return;
17959 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17960 CHECK_ACCESS(_res_ptr);
17961 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
17963 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
17966 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
17967 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17968 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
17969 return (int64_t)ret_conv;
17971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17972 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
17973 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
17977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17978 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
17979 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17980 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
17981 return (int64_t)ret_conv;
17984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17985 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17986 CHECK_ACCESS(o_ptr);
17987 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17988 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
17989 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17990 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
17991 return (int64_t)ret_conv;
17994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17995 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17996 CHECK_ACCESS(e_ptr);
17997 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17998 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17999 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18000 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
18001 return (int64_t)ret_conv;
18004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18005 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
18006 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
18010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18011 if ((_res & 1) != 0) return;
18012 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18013 CHECK_ACCESS(_res_ptr);
18014 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
18016 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
18019 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
18020 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18021 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
18022 return (int64_t)ret_conv;
18024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18025 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
18026 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
18030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18031 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
18032 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18033 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
18034 return (int64_t)ret_conv;
18037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18038 LDKThirtyTwoBytes o_ref;
18039 CHECK((*env)->GetArrayLength(env, o) == 32);
18040 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18041 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18042 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
18043 return (int64_t)ret_conv;
18046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
18047 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18048 *ret_conv = CResult_PaymentSecretNoneZ_err();
18049 return (int64_t)ret_conv;
18052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18053 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
18054 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
18058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18059 if ((_res & 1) != 0) return;
18060 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18061 CHECK_ACCESS(_res_ptr);
18062 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
18064 CResult_PaymentSecretNoneZ_free(_res_conv);
18067 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
18068 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18069 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
18070 return (int64_t)ret_conv;
18072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18073 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
18074 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
18078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18079 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
18080 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18081 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
18082 return (int64_t)ret_conv;
18085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18086 LDKThirtyTwoBytes o_ref;
18087 CHECK((*env)->GetArrayLength(env, o) == 32);
18088 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18089 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18090 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
18091 return (int64_t)ret_conv;
18094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18095 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18096 CHECK_ACCESS(e_ptr);
18097 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18098 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
18099 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18100 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
18101 return (int64_t)ret_conv;
18104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18105 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
18106 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
18110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18111 if ((_res & 1) != 0) return;
18112 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18113 CHECK_ACCESS(_res_ptr);
18114 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
18116 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
18119 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
18120 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18121 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
18122 return (int64_t)ret_conv;
18124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18125 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
18126 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
18130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18131 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
18132 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18133 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
18134 return (int64_t)ret_conv;
18137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18138 LDKThirtyTwoBytes o_ref;
18139 CHECK((*env)->GetArrayLength(env, o) == 32);
18140 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18141 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18142 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
18143 return (int64_t)ret_conv;
18146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18147 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18148 CHECK_ACCESS(e_ptr);
18149 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18150 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
18151 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18152 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
18153 return (int64_t)ret_conv;
18156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18157 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
18158 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
18162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18163 if ((_res & 1) != 0) return;
18164 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18165 CHECK_ACCESS(_res_ptr);
18166 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
18168 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
18171 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
18172 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18173 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
18174 return (int64_t)ret_conv;
18176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18177 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
18178 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
18182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18183 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
18184 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18185 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
18186 return (int64_t)ret_conv;
18189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18190 LDKCounterpartyForwardingInfo o_conv;
18191 o_conv.inner = (void*)(o & (~1));
18192 o_conv.is_owned = (o & 1) || (o == 0);
18193 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18194 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
18195 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18196 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
18197 return (int64_t)ret_conv;
18200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18201 LDKDecodeError e_conv;
18202 e_conv.inner = (void*)(e & (~1));
18203 e_conv.is_owned = (e & 1) || (e == 0);
18204 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18205 e_conv = DecodeError_clone(&e_conv);
18206 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18207 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
18208 return (int64_t)ret_conv;
18211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18212 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
18213 jboolean ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
18217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18218 if ((_res & 1) != 0) return;
18219 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18220 CHECK_ACCESS(_res_ptr);
18221 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
18223 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
18226 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
18227 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18228 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
18229 return (int64_t)ret_conv;
18231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18232 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
18233 int64_t ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
18237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18238 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
18239 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18240 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
18241 return (int64_t)ret_conv;
18244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18245 LDKChannelCounterparty o_conv;
18246 o_conv.inner = (void*)(o & (~1));
18247 o_conv.is_owned = (o & 1) || (o == 0);
18248 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18249 o_conv = ChannelCounterparty_clone(&o_conv);
18250 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18251 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
18252 return (int64_t)ret_conv;
18255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18256 LDKDecodeError e_conv;
18257 e_conv.inner = (void*)(e & (~1));
18258 e_conv.is_owned = (e & 1) || (e == 0);
18259 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18260 e_conv = DecodeError_clone(&e_conv);
18261 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18262 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
18263 return (int64_t)ret_conv;
18266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18267 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
18268 jboolean ret_val = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
18272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18273 if ((_res & 1) != 0) return;
18274 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18275 CHECK_ACCESS(_res_ptr);
18276 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
18278 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
18281 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
18282 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18283 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
18284 return (int64_t)ret_conv;
18286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18287 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
18288 int64_t ret_val = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
18292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18293 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
18294 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18295 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
18296 return (int64_t)ret_conv;
18299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18300 LDKChannelDetails o_conv;
18301 o_conv.inner = (void*)(o & (~1));
18302 o_conv.is_owned = (o & 1) || (o == 0);
18303 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18304 o_conv = ChannelDetails_clone(&o_conv);
18305 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18306 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
18307 return (int64_t)ret_conv;
18310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18311 LDKDecodeError e_conv;
18312 e_conv.inner = (void*)(e & (~1));
18313 e_conv.is_owned = (e & 1) || (e == 0);
18314 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18315 e_conv = DecodeError_clone(&e_conv);
18316 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18317 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
18318 return (int64_t)ret_conv;
18321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18322 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
18323 jboolean ret_val = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
18327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18328 if ((_res & 1) != 0) return;
18329 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18330 CHECK_ACCESS(_res_ptr);
18331 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
18333 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
18336 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
18337 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18338 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
18339 return (int64_t)ret_conv;
18341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18342 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
18343 int64_t ret_val = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
18347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18348 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
18349 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18350 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
18351 return (int64_t)ret_conv;
18354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18355 LDKPhantomRouteHints o_conv;
18356 o_conv.inner = (void*)(o & (~1));
18357 o_conv.is_owned = (o & 1) || (o == 0);
18358 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18359 o_conv = PhantomRouteHints_clone(&o_conv);
18360 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18361 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
18362 return (int64_t)ret_conv;
18365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18366 LDKDecodeError e_conv;
18367 e_conv.inner = (void*)(e & (~1));
18368 e_conv.is_owned = (e & 1) || (e == 0);
18369 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18370 e_conv = DecodeError_clone(&e_conv);
18371 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18372 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
18373 return (int64_t)ret_conv;
18376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18377 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
18378 jboolean ret_val = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
18382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18383 if ((_res & 1) != 0) return;
18384 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18385 CHECK_ACCESS(_res_ptr);
18386 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
18388 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
18391 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
18392 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18393 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
18394 return (int64_t)ret_conv;
18396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18397 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
18398 int64_t ret_val = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
18402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18403 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
18404 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18405 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
18406 return (int64_t)ret_conv;
18409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18410 LDKCVec_ChannelMonitorZ _res_constr;
18411 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18412 if (_res_constr.datalen > 0)
18413 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
18415 _res_constr.data = NULL;
18416 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18417 for (size_t q = 0; q < _res_constr.datalen; q++) {
18418 int64_t _res_conv_16 = _res_vals[q];
18419 LDKChannelMonitor _res_conv_16_conv;
18420 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
18421 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
18422 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18423 _res_constr.data[q] = _res_conv_16_conv;
18425 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18426 CVec_ChannelMonitorZ_free(_res_constr);
18429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18430 LDKThirtyTwoBytes a_ref;
18431 CHECK((*env)->GetArrayLength(env, a) == 32);
18432 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18433 LDKChannelManager b_conv;
18434 b_conv.inner = (void*)(b & (~1));
18435 b_conv.is_owned = (b & 1) || (b == 0);
18436 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18437 // WARNING: we need a move here but no clone is available for LDKChannelManager
18438 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
18439 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
18440 return ((int64_t)ret_conv);
18443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18444 if ((_res & 1) != 0) return;
18445 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18446 CHECK_ACCESS(_res_ptr);
18447 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
18449 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
18452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18453 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18454 CHECK_ACCESS(o_ptr);
18455 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
18456 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
18457 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18458 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
18459 return (int64_t)ret_conv;
18462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18463 LDKDecodeError e_conv;
18464 e_conv.inner = (void*)(e & (~1));
18465 e_conv.is_owned = (e & 1) || (e == 0);
18466 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18467 e_conv = DecodeError_clone(&e_conv);
18468 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18469 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
18470 return (int64_t)ret_conv;
18473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18474 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
18475 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
18479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18480 if ((_res & 1) != 0) return;
18481 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18482 CHECK_ACCESS(_res_ptr);
18483 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18485 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18489 LDKChannelConfig o_conv;
18490 o_conv.inner = (void*)(o & (~1));
18491 o_conv.is_owned = (o & 1) || (o == 0);
18492 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18493 o_conv = ChannelConfig_clone(&o_conv);
18494 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18495 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18496 return (int64_t)ret_conv;
18499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18500 LDKDecodeError e_conv;
18501 e_conv.inner = (void*)(e & (~1));
18502 e_conv.is_owned = (e & 1) || (e == 0);
18503 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18504 e_conv = DecodeError_clone(&e_conv);
18505 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18506 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18507 return (int64_t)ret_conv;
18510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18511 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
18512 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18517 if ((_res & 1) != 0) return;
18518 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18519 CHECK_ACCESS(_res_ptr);
18520 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18522 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18525 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18526 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18527 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18528 return (int64_t)ret_conv;
18530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18531 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
18532 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18537 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
18538 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18539 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18540 return (int64_t)ret_conv;
18543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18544 LDKOutPoint o_conv;
18545 o_conv.inner = (void*)(o & (~1));
18546 o_conv.is_owned = (o & 1) || (o == 0);
18547 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18548 o_conv = OutPoint_clone(&o_conv);
18549 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18550 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18551 return (int64_t)ret_conv;
18554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18555 LDKDecodeError e_conv;
18556 e_conv.inner = (void*)(e & (~1));
18557 e_conv.is_owned = (e & 1) || (e == 0);
18558 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18559 e_conv = DecodeError_clone(&e_conv);
18560 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18561 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18562 return (int64_t)ret_conv;
18565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18566 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
18567 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18572 if ((_res & 1) != 0) return;
18573 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18574 CHECK_ACCESS(_res_ptr);
18575 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18577 CResult_OutPointDecodeErrorZ_free(_res_conv);
18580 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18581 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18582 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18583 return (int64_t)ret_conv;
18585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18586 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
18587 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18592 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
18593 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18594 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18595 return (int64_t)ret_conv;
18598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18599 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18600 CHECK_ACCESS(o_ptr);
18601 LDKType o_conv = *(LDKType*)(o_ptr);
18602 if (o_conv.free == LDKType_JCalls_free) {
18603 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18604 LDKType_JCalls_cloned(&o_conv);
18606 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18607 *ret_copy = COption_TypeZ_some(o_conv);
18608 int64_t ret_ref = (uintptr_t)ret_copy;
18612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
18613 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18614 *ret_copy = COption_TypeZ_none();
18615 int64_t ret_ref = (uintptr_t)ret_copy;
18619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18620 if ((_res & 1) != 0) return;
18621 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18622 CHECK_ACCESS(_res_ptr);
18623 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18625 COption_TypeZ_free(_res_conv);
18628 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18629 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18630 *ret_copy = COption_TypeZ_clone(arg);
18631 int64_t ret_ref = (uintptr_t)ret_copy;
18634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18635 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
18636 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
18640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18641 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
18642 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18643 *ret_copy = COption_TypeZ_clone(orig_conv);
18644 int64_t ret_ref = (uintptr_t)ret_copy;
18648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18649 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18650 CHECK_ACCESS(o_ptr);
18651 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18652 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
18653 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18654 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18655 return (int64_t)ret_conv;
18658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18659 LDKDecodeError e_conv;
18660 e_conv.inner = (void*)(e & (~1));
18661 e_conv.is_owned = (e & 1) || (e == 0);
18662 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18663 e_conv = DecodeError_clone(&e_conv);
18664 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18665 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18666 return (int64_t)ret_conv;
18669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18670 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
18671 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18676 if ((_res & 1) != 0) return;
18677 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18678 CHECK_ACCESS(_res_ptr);
18679 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18681 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18684 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18685 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18686 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18687 return (int64_t)ret_conv;
18689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18690 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
18691 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18696 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
18697 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18698 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18699 return (int64_t)ret_conv;
18702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18703 LDKThirtyTwoBytes o_ref;
18704 CHECK((*env)->GetArrayLength(env, o) == 32);
18705 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18706 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18707 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18708 return (int64_t)ret_conv;
18711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18712 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18713 CHECK_ACCESS(e_ptr);
18714 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18715 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
18716 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18717 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18718 return (int64_t)ret_conv;
18721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18722 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
18723 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18728 if ((_res & 1) != 0) return;
18729 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18730 CHECK_ACCESS(_res_ptr);
18731 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18733 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18736 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18737 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18738 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18739 return (int64_t)ret_conv;
18741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18742 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
18743 int64_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18748 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
18749 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18750 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18751 return (int64_t)ret_conv;
18754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
18755 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
18756 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18757 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
18758 return (int64_t)ret_conv;
18761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18762 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18763 CHECK_ACCESS(e_ptr);
18764 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18765 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
18766 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18767 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
18768 return (int64_t)ret_conv;
18771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18772 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
18773 jboolean ret_val = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
18777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18778 if ((_res & 1) != 0) return;
18779 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18780 CHECK_ACCESS(_res_ptr);
18781 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
18783 CResult_SiPrefixParseErrorZ_free(_res_conv);
18786 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
18787 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18788 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
18789 return (int64_t)ret_conv;
18791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18792 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
18793 int64_t ret_val = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
18797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18798 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
18799 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18800 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
18801 return (int64_t)ret_conv;
18804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18806 o_conv.inner = (void*)(o & (~1));
18807 o_conv.is_owned = (o & 1) || (o == 0);
18808 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18809 o_conv = Invoice_clone(&o_conv);
18810 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18811 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
18812 return (int64_t)ret_conv;
18815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18816 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18817 CHECK_ACCESS(e_ptr);
18818 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
18819 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
18820 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18821 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
18822 return (int64_t)ret_conv;
18825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18826 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
18827 jboolean ret_val = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
18831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18832 if ((_res & 1) != 0) return;
18833 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18834 CHECK_ACCESS(_res_ptr);
18835 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
18837 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
18840 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
18841 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18842 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
18843 return (int64_t)ret_conv;
18845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18846 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
18847 int64_t ret_val = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
18851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18852 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
18853 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18854 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
18855 return (int64_t)ret_conv;
18858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18859 LDKSignedRawInvoice o_conv;
18860 o_conv.inner = (void*)(o & (~1));
18861 o_conv.is_owned = (o & 1) || (o == 0);
18862 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18863 o_conv = SignedRawInvoice_clone(&o_conv);
18864 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18865 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
18866 return (int64_t)ret_conv;
18869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18870 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18871 CHECK_ACCESS(e_ptr);
18872 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18873 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
18874 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18875 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
18876 return (int64_t)ret_conv;
18879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18880 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
18881 jboolean ret_val = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
18885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18886 if ((_res & 1) != 0) return;
18887 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18888 CHECK_ACCESS(_res_ptr);
18889 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
18891 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
18894 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
18895 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18896 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
18897 return (int64_t)ret_conv;
18899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18900 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
18901 int64_t ret_val = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
18905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18906 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
18907 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18908 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
18909 return (int64_t)ret_conv;
18912 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
18913 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18914 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
18915 return ((int64_t)ret_conv);
18917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18918 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
18919 int64_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
18923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18924 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
18925 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18926 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
18927 return ((int64_t)ret_conv);
18930 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) {
18931 LDKRawInvoice a_conv;
18932 a_conv.inner = (void*)(a & (~1));
18933 a_conv.is_owned = (a & 1) || (a == 0);
18934 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18935 a_conv = RawInvoice_clone(&a_conv);
18936 LDKThirtyTwoBytes b_ref;
18937 CHECK((*env)->GetArrayLength(env, b) == 32);
18938 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18939 LDKInvoiceSignature c_conv;
18940 c_conv.inner = (void*)(c & (~1));
18941 c_conv.is_owned = (c & 1) || (c == 0);
18942 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
18943 c_conv = InvoiceSignature_clone(&c_conv);
18944 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18945 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
18946 return ((int64_t)ret_conv);
18949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18950 if ((_res & 1) != 0) return;
18951 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18952 CHECK_ACCESS(_res_ptr);
18953 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
18955 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
18958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18959 LDKPayeePubKey o_conv;
18960 o_conv.inner = (void*)(o & (~1));
18961 o_conv.is_owned = (o & 1) || (o == 0);
18962 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18963 o_conv = PayeePubKey_clone(&o_conv);
18964 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18965 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
18966 return (int64_t)ret_conv;
18969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18970 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
18971 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18972 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
18973 return (int64_t)ret_conv;
18976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18977 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
18978 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
18982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18983 if ((_res & 1) != 0) return;
18984 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18985 CHECK_ACCESS(_res_ptr);
18986 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
18988 CResult_PayeePubKeyErrorZ_free(_res_conv);
18991 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
18992 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18993 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
18994 return (int64_t)ret_conv;
18996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18997 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
18998 int64_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19003 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
19004 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19005 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19006 return (int64_t)ret_conv;
19009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19010 LDKCVec_PrivateRouteZ _res_constr;
19011 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19012 if (_res_constr.datalen > 0)
19013 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19015 _res_constr.data = NULL;
19016 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19017 for (size_t o = 0; o < _res_constr.datalen; o++) {
19018 int64_t _res_conv_14 = _res_vals[o];
19019 LDKPrivateRoute _res_conv_14_conv;
19020 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
19021 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
19022 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19023 _res_constr.data[o] = _res_conv_14_conv;
19025 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19026 CVec_PrivateRouteZ_free(_res_constr);
19029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19030 LDKPositiveTimestamp o_conv;
19031 o_conv.inner = (void*)(o & (~1));
19032 o_conv.is_owned = (o & 1) || (o == 0);
19033 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19034 o_conv = PositiveTimestamp_clone(&o_conv);
19035 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19036 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19037 return (int64_t)ret_conv;
19040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19041 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19042 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19043 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19044 return (int64_t)ret_conv;
19047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19048 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
19049 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19054 if ((_res & 1) != 0) return;
19055 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19056 CHECK_ACCESS(_res_ptr);
19057 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19059 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19062 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19063 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19064 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19065 return (int64_t)ret_conv;
19067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19068 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
19069 int64_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19074 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
19075 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19076 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19077 return (int64_t)ret_conv;
19080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
19081 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19082 *ret_conv = CResult_NoneSemanticErrorZ_ok();
19083 return (int64_t)ret_conv;
19086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19087 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19088 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19089 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19090 return (int64_t)ret_conv;
19093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19094 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
19095 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19100 if ((_res & 1) != 0) return;
19101 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19102 CHECK_ACCESS(_res_ptr);
19103 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19105 CResult_NoneSemanticErrorZ_free(_res_conv);
19108 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19109 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19110 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19111 return (int64_t)ret_conv;
19113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19114 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
19115 int64_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19120 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
19121 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19122 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19123 return (int64_t)ret_conv;
19126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19128 o_conv.inner = (void*)(o & (~1));
19129 o_conv.is_owned = (o & 1) || (o == 0);
19130 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19131 o_conv = Invoice_clone(&o_conv);
19132 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19133 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19134 return (int64_t)ret_conv;
19137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19138 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19139 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19140 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19141 return (int64_t)ret_conv;
19144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19145 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
19146 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19151 if ((_res & 1) != 0) return;
19152 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19153 CHECK_ACCESS(_res_ptr);
19154 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19156 CResult_InvoiceSemanticErrorZ_free(_res_conv);
19159 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
19160 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19161 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
19162 return (int64_t)ret_conv;
19164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19165 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
19166 int64_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
19170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19171 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
19172 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19173 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
19174 return (int64_t)ret_conv;
19177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19178 LDKDescription o_conv;
19179 o_conv.inner = (void*)(o & (~1));
19180 o_conv.is_owned = (o & 1) || (o == 0);
19181 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19182 o_conv = Description_clone(&o_conv);
19183 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19184 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
19185 return (int64_t)ret_conv;
19188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19189 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19190 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19191 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
19192 return (int64_t)ret_conv;
19195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19196 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
19197 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
19201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19202 if ((_res & 1) != 0) return;
19203 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19204 CHECK_ACCESS(_res_ptr);
19205 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
19207 CResult_DescriptionCreationErrorZ_free(_res_conv);
19210 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
19211 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19212 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
19213 return (int64_t)ret_conv;
19215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19216 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
19217 int64_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
19221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19222 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
19223 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19224 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
19225 return (int64_t)ret_conv;
19228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19229 LDKPrivateRoute o_conv;
19230 o_conv.inner = (void*)(o & (~1));
19231 o_conv.is_owned = (o & 1) || (o == 0);
19232 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19233 o_conv = PrivateRoute_clone(&o_conv);
19234 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19235 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
19236 return (int64_t)ret_conv;
19239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19240 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19241 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19242 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
19243 return (int64_t)ret_conv;
19246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19247 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
19248 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
19252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19253 if ((_res & 1) != 0) return;
19254 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19255 CHECK_ACCESS(_res_ptr);
19256 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
19258 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
19261 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
19262 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19263 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
19264 return (int64_t)ret_conv;
19266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19267 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
19268 int64_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
19272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19273 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
19274 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19275 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
19276 return (int64_t)ret_conv;
19279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
19280 LDKStr o_conv = java_to_owned_str(env, o);
19281 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19282 *ret_conv = CResult_StringErrorZ_ok(o_conv);
19283 return (int64_t)ret_conv;
19286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19287 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
19288 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19289 *ret_conv = CResult_StringErrorZ_err(e_conv);
19290 return (int64_t)ret_conv;
19293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19294 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
19295 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
19299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_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 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
19305 CResult_StringErrorZ_free(_res_conv);
19308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19309 LDKChannelMonitorUpdate o_conv;
19310 o_conv.inner = (void*)(o & (~1));
19311 o_conv.is_owned = (o & 1) || (o == 0);
19312 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19313 o_conv = ChannelMonitorUpdate_clone(&o_conv);
19314 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19315 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
19316 return (int64_t)ret_conv;
19319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19320 LDKDecodeError e_conv;
19321 e_conv.inner = (void*)(e & (~1));
19322 e_conv.is_owned = (e & 1) || (e == 0);
19323 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19324 e_conv = DecodeError_clone(&e_conv);
19325 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19326 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
19327 return (int64_t)ret_conv;
19330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19331 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
19332 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
19336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19337 if ((_res & 1) != 0) return;
19338 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19339 CHECK_ACCESS(_res_ptr);
19340 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
19342 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
19345 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
19346 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19347 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
19348 return (int64_t)ret_conv;
19350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19351 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
19352 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
19356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19357 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
19358 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19359 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
19360 return (int64_t)ret_conv;
19363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19364 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19365 CHECK_ACCESS(o_ptr);
19366 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
19367 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
19368 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19369 *ret_copy = COption_MonitorEventZ_some(o_conv);
19370 int64_t ret_ref = (uintptr_t)ret_copy;
19374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
19375 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19376 *ret_copy = COption_MonitorEventZ_none();
19377 int64_t ret_ref = (uintptr_t)ret_copy;
19381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19382 if ((_res & 1) != 0) return;
19383 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19384 CHECK_ACCESS(_res_ptr);
19385 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
19387 COption_MonitorEventZ_free(_res_conv);
19390 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
19391 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19392 *ret_copy = COption_MonitorEventZ_clone(arg);
19393 int64_t ret_ref = (uintptr_t)ret_copy;
19396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19397 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
19398 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
19402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19403 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
19404 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19405 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
19406 int64_t ret_ref = (uintptr_t)ret_copy;
19410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19411 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19412 CHECK_ACCESS(o_ptr);
19413 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
19414 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
19415 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19416 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
19417 return (int64_t)ret_conv;
19420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19421 LDKDecodeError e_conv;
19422 e_conv.inner = (void*)(e & (~1));
19423 e_conv.is_owned = (e & 1) || (e == 0);
19424 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19425 e_conv = DecodeError_clone(&e_conv);
19426 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19427 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
19428 return (int64_t)ret_conv;
19431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19432 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
19433 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
19437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19438 if ((_res & 1) != 0) return;
19439 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19440 CHECK_ACCESS(_res_ptr);
19441 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
19443 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
19446 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
19447 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19448 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
19449 return (int64_t)ret_conv;
19451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19452 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
19453 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
19457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19458 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
19459 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19460 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
19461 return (int64_t)ret_conv;
19464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19465 LDKHTLCUpdate o_conv;
19466 o_conv.inner = (void*)(o & (~1));
19467 o_conv.is_owned = (o & 1) || (o == 0);
19468 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19469 o_conv = HTLCUpdate_clone(&o_conv);
19470 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19471 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
19472 return (int64_t)ret_conv;
19475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19476 LDKDecodeError e_conv;
19477 e_conv.inner = (void*)(e & (~1));
19478 e_conv.is_owned = (e & 1) || (e == 0);
19479 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19480 e_conv = DecodeError_clone(&e_conv);
19481 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19482 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
19483 return (int64_t)ret_conv;
19486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19487 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
19488 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
19492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19493 if ((_res & 1) != 0) return;
19494 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19495 CHECK_ACCESS(_res_ptr);
19496 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
19498 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
19501 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
19502 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19503 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
19504 return (int64_t)ret_conv;
19506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19507 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
19508 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
19512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19513 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
19514 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19515 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
19516 return (int64_t)ret_conv;
19519 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
19520 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19521 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
19522 return ((int64_t)ret_conv);
19524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19525 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
19526 int64_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
19530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19531 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
19532 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19533 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
19534 return ((int64_t)ret_conv);
19537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
19538 LDKOutPoint a_conv;
19539 a_conv.inner = (void*)(a & (~1));
19540 a_conv.is_owned = (a & 1) || (a == 0);
19541 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19542 a_conv = OutPoint_clone(&a_conv);
19544 b_ref.datalen = (*env)->GetArrayLength(env, b);
19545 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19546 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19547 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19548 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
19549 return ((int64_t)ret_conv);
19552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19553 if ((_res & 1) != 0) return;
19554 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19555 CHECK_ACCESS(_res_ptr);
19556 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
19558 C2Tuple_OutPointScriptZ_free(_res_conv);
19561 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
19562 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19563 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
19564 return ((int64_t)ret_conv);
19566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19567 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
19568 int64_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
19572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19573 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
19574 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19575 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
19576 return ((int64_t)ret_conv);
19579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
19581 b_ref.datalen = (*env)->GetArrayLength(env, b);
19582 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19583 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19584 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19585 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
19586 return ((int64_t)ret_conv);
19589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19590 if ((_res & 1) != 0) return;
19591 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19592 CHECK_ACCESS(_res_ptr);
19593 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
19595 C2Tuple_u32ScriptZ_free(_res_conv);
19598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19599 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
19600 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19601 if (_res_constr.datalen > 0)
19602 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19604 _res_constr.data = NULL;
19605 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19606 for (size_t v = 0; v < _res_constr.datalen; v++) {
19607 int64_t _res_conv_21 = _res_vals[v];
19608 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
19609 CHECK_ACCESS(_res_conv_21_ptr);
19610 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
19611 FREE((void*)_res_conv_21);
19612 _res_constr.data[v] = _res_conv_21_conv;
19614 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19615 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
19618 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
19619 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19620 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
19621 return ((int64_t)ret_conv);
19623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19624 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
19625 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
19629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19630 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
19631 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19632 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
19633 return ((int64_t)ret_conv);
19636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19637 LDKThirtyTwoBytes a_ref;
19638 CHECK((*env)->GetArrayLength(env, a) == 32);
19639 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19640 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
19641 b_constr.datalen = (*env)->GetArrayLength(env, b);
19642 if (b_constr.datalen > 0)
19643 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19645 b_constr.data = NULL;
19646 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19647 for (size_t v = 0; v < b_constr.datalen; v++) {
19648 int64_t b_conv_21 = b_vals[v];
19649 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
19650 CHECK_ACCESS(b_conv_21_ptr);
19651 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
19652 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
19653 b_constr.data[v] = b_conv_21_conv;
19655 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19656 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19657 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
19658 return ((int64_t)ret_conv);
19661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19662 if ((_res & 1) != 0) return;
19663 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19664 CHECK_ACCESS(_res_ptr);
19665 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
19667 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
19670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19671 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
19672 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19673 if (_res_constr.datalen > 0)
19674 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
19676 _res_constr.data = NULL;
19677 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19678 for (size_t o = 0; o < _res_constr.datalen; o++) {
19679 int64_t _res_conv_40 = _res_vals[o];
19680 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
19681 CHECK_ACCESS(_res_conv_40_ptr);
19682 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
19683 FREE((void*)_res_conv_40);
19684 _res_constr.data[o] = _res_conv_40_conv;
19686 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19687 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
19690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19691 LDKCVec_EventZ _res_constr;
19692 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19693 if (_res_constr.datalen > 0)
19694 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
19696 _res_constr.data = NULL;
19697 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19698 for (size_t h = 0; h < _res_constr.datalen; h++) {
19699 int64_t _res_conv_7 = _res_vals[h];
19700 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
19701 CHECK_ACCESS(_res_conv_7_ptr);
19702 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
19703 FREE((void*)_res_conv_7);
19704 _res_constr.data[h] = _res_conv_7_conv;
19706 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19707 CVec_EventZ_free(_res_constr);
19710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19711 LDKCVec_TransactionZ _res_constr;
19712 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19713 if (_res_constr.datalen > 0)
19714 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
19716 _res_constr.data = NULL;
19717 for (size_t i = 0; i < _res_constr.datalen; i++) {
19718 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19719 LDKTransaction _res_conv_8_ref;
19720 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
19721 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
19722 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
19723 _res_conv_8_ref.data_is_owned = true;
19724 _res_constr.data[i] = _res_conv_8_ref;
19726 CVec_TransactionZ_free(_res_constr);
19729 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
19730 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19731 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
19732 return ((int64_t)ret_conv);
19734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19735 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
19736 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
19740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19741 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
19742 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19743 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
19744 return ((int64_t)ret_conv);
19747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
19748 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
19749 CHECK_ACCESS(b_ptr);
19750 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
19751 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
19752 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19753 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
19754 return ((int64_t)ret_conv);
19757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19758 if ((_res & 1) != 0) return;
19759 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19760 CHECK_ACCESS(_res_ptr);
19761 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
19763 C2Tuple_u32TxOutZ_free(_res_conv);
19766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19767 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
19768 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19769 if (_res_constr.datalen > 0)
19770 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19772 _res_constr.data = NULL;
19773 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19774 for (size_t u = 0; u < _res_constr.datalen; u++) {
19775 int64_t _res_conv_20 = _res_vals[u];
19776 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
19777 CHECK_ACCESS(_res_conv_20_ptr);
19778 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
19779 FREE((void*)_res_conv_20);
19780 _res_constr.data[u] = _res_conv_20_conv;
19782 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19783 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
19786 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
19787 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19788 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
19789 return ((int64_t)ret_conv);
19791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19792 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
19793 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19798 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
19799 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19800 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19801 return ((int64_t)ret_conv);
19804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19805 LDKThirtyTwoBytes a_ref;
19806 CHECK((*env)->GetArrayLength(env, a) == 32);
19807 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19808 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19809 b_constr.datalen = (*env)->GetArrayLength(env, b);
19810 if (b_constr.datalen > 0)
19811 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19813 b_constr.data = NULL;
19814 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19815 for (size_t u = 0; u < b_constr.datalen; u++) {
19816 int64_t b_conv_20 = b_vals[u];
19817 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
19818 CHECK_ACCESS(b_conv_20_ptr);
19819 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19820 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
19821 b_constr.data[u] = b_conv_20_conv;
19823 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19824 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19825 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19826 return ((int64_t)ret_conv);
19829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19830 if ((_res & 1) != 0) return;
19831 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19832 CHECK_ACCESS(_res_ptr);
19833 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19835 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19839 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19840 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19841 if (_res_constr.datalen > 0)
19842 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19844 _res_constr.data = NULL;
19845 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19846 for (size_t n = 0; n < _res_constr.datalen; n++) {
19847 int64_t _res_conv_39 = _res_vals[n];
19848 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
19849 CHECK_ACCESS(_res_conv_39_ptr);
19850 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19851 FREE((void*)_res_conv_39);
19852 _res_constr.data[n] = _res_conv_39_conv;
19854 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19855 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19859 LDKCVec_BalanceZ _res_constr;
19860 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19861 if (_res_constr.datalen > 0)
19862 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19864 _res_constr.data = NULL;
19865 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19866 for (size_t j = 0; j < _res_constr.datalen; j++) {
19867 int64_t _res_conv_9 = _res_vals[j];
19868 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
19869 CHECK_ACCESS(_res_conv_9_ptr);
19870 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19871 FREE((void*)_res_conv_9);
19872 _res_constr.data[j] = _res_conv_9_conv;
19874 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19875 CVec_BalanceZ_free(_res_constr);
19878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19879 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19880 CHECK_ACCESS(o_ptr);
19881 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19882 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
19883 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19884 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19885 return (int64_t)ret_conv;
19888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19889 LDKDecodeError e_conv;
19890 e_conv.inner = (void*)(e & (~1));
19891 e_conv.is_owned = (e & 1) || (e == 0);
19892 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19893 e_conv = DecodeError_clone(&e_conv);
19894 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19895 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19896 return (int64_t)ret_conv;
19899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19900 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
19901 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19906 if ((_res & 1) != 0) return;
19907 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19908 CHECK_ACCESS(_res_ptr);
19909 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19911 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19914 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19915 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19916 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19917 return (int64_t)ret_conv;
19919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19920 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
19921 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19926 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
19927 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19928 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19929 return (int64_t)ret_conv;
19932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
19933 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19934 *ret_conv = CResult_NoneLightningErrorZ_ok();
19935 return (int64_t)ret_conv;
19938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19939 LDKLightningError e_conv;
19940 e_conv.inner = (void*)(e & (~1));
19941 e_conv.is_owned = (e & 1) || (e == 0);
19942 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19943 e_conv = LightningError_clone(&e_conv);
19944 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19945 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19946 return (int64_t)ret_conv;
19949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19950 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
19951 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
19955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19956 if ((_res & 1) != 0) return;
19957 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19958 CHECK_ACCESS(_res_ptr);
19959 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19961 CResult_NoneLightningErrorZ_free(_res_conv);
19964 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19965 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19966 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19967 return (int64_t)ret_conv;
19969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19970 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
19971 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19976 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
19977 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19978 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19979 return (int64_t)ret_conv;
19982 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
19983 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19984 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
19985 return ((int64_t)ret_conv);
19987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19988 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
19989 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
19993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19994 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
19995 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19996 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
19997 return ((int64_t)ret_conv);
20000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20001 LDKPublicKey a_ref;
20002 CHECK((*env)->GetArrayLength(env, a) == 33);
20003 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
20004 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
20005 CHECK_ACCESS(b_ptr);
20006 LDKType b_conv = *(LDKType*)(b_ptr);
20007 if (b_conv.free == LDKType_JCalls_free) {
20008 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20009 LDKType_JCalls_cloned(&b_conv);
20011 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20012 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
20013 return ((int64_t)ret_conv);
20016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20017 if ((_res & 1) != 0) return;
20018 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20019 CHECK_ACCESS(_res_ptr);
20020 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
20022 C2Tuple_PublicKeyTypeZ_free(_res_conv);
20025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20026 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
20027 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20028 if (_res_constr.datalen > 0)
20029 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
20031 _res_constr.data = NULL;
20032 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20033 for (size_t z = 0; z < _res_constr.datalen; z++) {
20034 int64_t _res_conv_25 = _res_vals[z];
20035 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
20036 CHECK_ACCESS(_res_conv_25_ptr);
20037 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
20038 FREE((void*)_res_conv_25);
20039 _res_constr.data[z] = _res_conv_25_conv;
20041 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20042 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
20045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
20046 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20047 *ret_conv = CResult_boolLightningErrorZ_ok(o);
20048 return (int64_t)ret_conv;
20051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20052 LDKLightningError e_conv;
20053 e_conv.inner = (void*)(e & (~1));
20054 e_conv.is_owned = (e & 1) || (e == 0);
20055 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20056 e_conv = LightningError_clone(&e_conv);
20057 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20058 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
20059 return (int64_t)ret_conv;
20062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20063 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
20064 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
20068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20069 if ((_res & 1) != 0) return;
20070 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20071 CHECK_ACCESS(_res_ptr);
20072 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
20074 CResult_boolLightningErrorZ_free(_res_conv);
20077 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
20078 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20079 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
20080 return (int64_t)ret_conv;
20082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20083 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
20084 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
20088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20089 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
20090 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20091 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
20092 return (int64_t)ret_conv;
20095 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
20096 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20097 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
20098 return ((int64_t)ret_conv);
20100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20101 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
20102 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
20106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20107 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
20108 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20109 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
20110 return ((int64_t)ret_conv);
20113 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) {
20114 LDKChannelAnnouncement a_conv;
20115 a_conv.inner = (void*)(a & (~1));
20116 a_conv.is_owned = (a & 1) || (a == 0);
20117 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20118 a_conv = ChannelAnnouncement_clone(&a_conv);
20119 LDKChannelUpdate b_conv;
20120 b_conv.inner = (void*)(b & (~1));
20121 b_conv.is_owned = (b & 1) || (b == 0);
20122 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20123 b_conv = ChannelUpdate_clone(&b_conv);
20124 LDKChannelUpdate c_conv;
20125 c_conv.inner = (void*)(c & (~1));
20126 c_conv.is_owned = (c & 1) || (c == 0);
20127 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20128 c_conv = ChannelUpdate_clone(&c_conv);
20129 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20130 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
20131 return ((int64_t)ret_conv);
20134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20135 if ((_res & 1) != 0) return;
20136 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20137 CHECK_ACCESS(_res_ptr);
20138 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
20140 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
20143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20144 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
20145 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20146 if (_res_constr.datalen > 0)
20147 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
20149 _res_constr.data = NULL;
20150 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20151 for (size_t h = 0; h < _res_constr.datalen; h++) {
20152 int64_t _res_conv_59 = _res_vals[h];
20153 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
20154 CHECK_ACCESS(_res_conv_59_ptr);
20155 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
20156 FREE((void*)_res_conv_59);
20157 _res_constr.data[h] = _res_conv_59_conv;
20159 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20160 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
20163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20164 LDKCVec_NodeAnnouncementZ _res_constr;
20165 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20166 if (_res_constr.datalen > 0)
20167 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
20169 _res_constr.data = NULL;
20170 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20171 for (size_t s = 0; s < _res_constr.datalen; s++) {
20172 int64_t _res_conv_18 = _res_vals[s];
20173 LDKNodeAnnouncement _res_conv_18_conv;
20174 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
20175 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
20176 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
20177 _res_constr.data[s] = _res_conv_18_conv;
20179 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20180 CVec_NodeAnnouncementZ_free(_res_constr);
20183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20184 LDKCVec_PublicKeyZ _res_constr;
20185 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20186 if (_res_constr.datalen > 0)
20187 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20189 _res_constr.data = NULL;
20190 for (size_t i = 0; i < _res_constr.datalen; i++) {
20191 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20192 LDKPublicKey _res_conv_8_ref;
20193 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
20194 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
20195 _res_constr.data[i] = _res_conv_8_ref;
20197 CVec_PublicKeyZ_free(_res_constr);
20200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20201 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20202 CHECK_ACCESS(o_ptr);
20203 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20204 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
20205 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20206 *ret_copy = COption_NetAddressZ_some(o_conv);
20207 int64_t ret_ref = (uintptr_t)ret_copy;
20211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
20212 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20213 *ret_copy = COption_NetAddressZ_none();
20214 int64_t ret_ref = (uintptr_t)ret_copy;
20218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20219 if ((_res & 1) != 0) return;
20220 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20221 CHECK_ACCESS(_res_ptr);
20222 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
20224 COption_NetAddressZ_free(_res_conv);
20227 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
20228 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20229 *ret_copy = COption_NetAddressZ_clone(arg);
20230 int64_t ret_ref = (uintptr_t)ret_copy;
20233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20234 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
20235 int64_t ret_val = COption_NetAddressZ_clone_ptr(arg_conv);
20239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20240 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
20241 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20242 *ret_copy = COption_NetAddressZ_clone(orig_conv);
20243 int64_t ret_ref = (uintptr_t)ret_copy;
20247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20249 o_ref.datalen = (*env)->GetArrayLength(env, o);
20250 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20251 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20252 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20253 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
20254 return (int64_t)ret_conv;
20257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20258 LDKPeerHandleError e_conv;
20259 e_conv.inner = (void*)(e & (~1));
20260 e_conv.is_owned = (e & 1) || (e == 0);
20261 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20262 e_conv = PeerHandleError_clone(&e_conv);
20263 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20264 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
20265 return (int64_t)ret_conv;
20268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20269 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
20270 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
20274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20275 if ((_res & 1) != 0) return;
20276 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20277 CHECK_ACCESS(_res_ptr);
20278 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
20280 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
20283 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
20284 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20285 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
20286 return (int64_t)ret_conv;
20288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20289 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
20290 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
20294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20295 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
20296 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20297 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
20298 return (int64_t)ret_conv;
20301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
20302 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20303 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
20304 return (int64_t)ret_conv;
20307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20308 LDKPeerHandleError e_conv;
20309 e_conv.inner = (void*)(e & (~1));
20310 e_conv.is_owned = (e & 1) || (e == 0);
20311 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20312 e_conv = PeerHandleError_clone(&e_conv);
20313 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20314 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
20315 return (int64_t)ret_conv;
20318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20319 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
20320 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
20324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20325 if ((_res & 1) != 0) return;
20326 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20327 CHECK_ACCESS(_res_ptr);
20328 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
20330 CResult_NonePeerHandleErrorZ_free(_res_conv);
20333 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
20334 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20335 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
20336 return (int64_t)ret_conv;
20338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20339 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
20340 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
20344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20345 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
20346 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20347 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
20348 return (int64_t)ret_conv;
20351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
20352 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20353 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
20354 return (int64_t)ret_conv;
20357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20358 LDKPeerHandleError e_conv;
20359 e_conv.inner = (void*)(e & (~1));
20360 e_conv.is_owned = (e & 1) || (e == 0);
20361 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20362 e_conv = PeerHandleError_clone(&e_conv);
20363 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20364 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
20365 return (int64_t)ret_conv;
20368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20369 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
20370 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
20374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20375 if ((_res & 1) != 0) return;
20376 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20377 CHECK_ACCESS(_res_ptr);
20378 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
20380 CResult_boolPeerHandleErrorZ_free(_res_conv);
20383 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
20384 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20385 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
20386 return (int64_t)ret_conv;
20388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20389 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
20390 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
20394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20395 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
20396 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20397 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
20398 return (int64_t)ret_conv;
20401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20403 o_conv.inner = (void*)(o & (~1));
20404 o_conv.is_owned = (o & 1) || (o == 0);
20405 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20406 o_conv = NodeId_clone(&o_conv);
20407 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20408 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
20409 return (int64_t)ret_conv;
20412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20413 LDKDecodeError e_conv;
20414 e_conv.inner = (void*)(e & (~1));
20415 e_conv.is_owned = (e & 1) || (e == 0);
20416 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20417 e_conv = DecodeError_clone(&e_conv);
20418 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20419 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
20420 return (int64_t)ret_conv;
20423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20424 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
20425 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
20429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20430 if ((_res & 1) != 0) return;
20431 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20432 CHECK_ACCESS(_res_ptr);
20433 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
20435 CResult_NodeIdDecodeErrorZ_free(_res_conv);
20438 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
20439 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20440 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
20441 return (int64_t)ret_conv;
20443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20444 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
20445 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
20449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20450 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
20451 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20452 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
20453 return (int64_t)ret_conv;
20456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20457 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20458 CHECK_ACCESS(o_ptr);
20459 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
20460 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
20461 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20462 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
20463 return (int64_t)ret_conv;
20466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20467 LDKDecodeError e_conv;
20468 e_conv.inner = (void*)(e & (~1));
20469 e_conv.is_owned = (e & 1) || (e == 0);
20470 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20471 e_conv = DecodeError_clone(&e_conv);
20472 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20473 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
20474 return (int64_t)ret_conv;
20477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20478 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
20479 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20484 if ((_res & 1) != 0) return;
20485 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20486 CHECK_ACCESS(_res_ptr);
20487 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20489 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20492 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20493 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20494 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20495 return (int64_t)ret_conv;
20497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20498 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
20499 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20504 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
20505 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20506 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20507 return (int64_t)ret_conv;
20510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20511 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20512 CHECK_ACCESS(o_ptr);
20513 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
20514 if (o_conv.free == LDKAccess_JCalls_free) {
20515 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20516 LDKAccess_JCalls_cloned(&o_conv);
20518 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20519 *ret_copy = COption_AccessZ_some(o_conv);
20520 int64_t ret_ref = (uintptr_t)ret_copy;
20524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
20525 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20526 *ret_copy = COption_AccessZ_none();
20527 int64_t ret_ref = (uintptr_t)ret_copy;
20531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20532 if ((_res & 1) != 0) return;
20533 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20534 CHECK_ACCESS(_res_ptr);
20535 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
20537 COption_AccessZ_free(_res_conv);
20540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20541 LDKChannelUpdateInfo o_conv;
20542 o_conv.inner = (void*)(o & (~1));
20543 o_conv.is_owned = (o & 1) || (o == 0);
20544 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20545 o_conv = ChannelUpdateInfo_clone(&o_conv);
20546 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20547 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
20548 return (int64_t)ret_conv;
20551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20552 LDKDecodeError e_conv;
20553 e_conv.inner = (void*)(e & (~1));
20554 e_conv.is_owned = (e & 1) || (e == 0);
20555 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20556 e_conv = DecodeError_clone(&e_conv);
20557 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20558 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
20559 return (int64_t)ret_conv;
20562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20563 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
20564 jboolean ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
20568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20569 if ((_res & 1) != 0) return;
20570 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20571 CHECK_ACCESS(_res_ptr);
20572 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
20574 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
20577 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
20578 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20579 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
20580 return (int64_t)ret_conv;
20582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20583 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
20584 int64_t ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
20588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20589 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
20590 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20591 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
20592 return (int64_t)ret_conv;
20595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20596 LDKChannelInfo o_conv;
20597 o_conv.inner = (void*)(o & (~1));
20598 o_conv.is_owned = (o & 1) || (o == 0);
20599 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20600 o_conv = ChannelInfo_clone(&o_conv);
20601 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20602 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
20603 return (int64_t)ret_conv;
20606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20607 LDKDecodeError e_conv;
20608 e_conv.inner = (void*)(e & (~1));
20609 e_conv.is_owned = (e & 1) || (e == 0);
20610 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20611 e_conv = DecodeError_clone(&e_conv);
20612 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20613 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
20614 return (int64_t)ret_conv;
20617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20618 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
20619 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
20623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20624 if ((_res & 1) != 0) return;
20625 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20626 CHECK_ACCESS(_res_ptr);
20627 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
20629 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
20632 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
20633 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20634 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
20635 return (int64_t)ret_conv;
20637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20638 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
20639 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
20643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20644 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
20645 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20646 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
20647 return (int64_t)ret_conv;
20650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20651 LDKRoutingFees o_conv;
20652 o_conv.inner = (void*)(o & (~1));
20653 o_conv.is_owned = (o & 1) || (o == 0);
20654 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20655 o_conv = RoutingFees_clone(&o_conv);
20656 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20657 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
20658 return (int64_t)ret_conv;
20661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20662 LDKDecodeError e_conv;
20663 e_conv.inner = (void*)(e & (~1));
20664 e_conv.is_owned = (e & 1) || (e == 0);
20665 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20666 e_conv = DecodeError_clone(&e_conv);
20667 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20668 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
20669 return (int64_t)ret_conv;
20672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20673 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
20674 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
20678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20679 if ((_res & 1) != 0) return;
20680 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20681 CHECK_ACCESS(_res_ptr);
20682 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
20684 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
20687 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
20688 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20689 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
20690 return (int64_t)ret_conv;
20692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20693 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
20694 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
20698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20699 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
20700 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20701 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
20702 return (int64_t)ret_conv;
20705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20706 LDKNodeAnnouncementInfo o_conv;
20707 o_conv.inner = (void*)(o & (~1));
20708 o_conv.is_owned = (o & 1) || (o == 0);
20709 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20710 o_conv = NodeAnnouncementInfo_clone(&o_conv);
20711 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20712 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
20713 return (int64_t)ret_conv;
20716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20717 LDKDecodeError e_conv;
20718 e_conv.inner = (void*)(e & (~1));
20719 e_conv.is_owned = (e & 1) || (e == 0);
20720 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20721 e_conv = DecodeError_clone(&e_conv);
20722 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20723 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
20724 return (int64_t)ret_conv;
20727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20728 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
20729 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
20733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20734 if ((_res & 1) != 0) return;
20735 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20736 CHECK_ACCESS(_res_ptr);
20737 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
20739 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
20742 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
20743 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20744 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
20745 return (int64_t)ret_conv;
20747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20748 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
20749 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
20753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20754 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
20755 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20756 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
20757 return (int64_t)ret_conv;
20760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20761 LDKCVec_u64Z _res_constr;
20762 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20763 if (_res_constr.datalen > 0)
20764 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20766 _res_constr.data = NULL;
20767 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20768 for (size_t g = 0; g < _res_constr.datalen; g++) {
20769 int64_t _res_conv_6 = _res_vals[g];
20770 _res_constr.data[g] = _res_conv_6;
20772 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20773 CVec_u64Z_free(_res_constr);
20776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20777 LDKNodeInfo o_conv;
20778 o_conv.inner = (void*)(o & (~1));
20779 o_conv.is_owned = (o & 1) || (o == 0);
20780 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20781 o_conv = NodeInfo_clone(&o_conv);
20782 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20783 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
20784 return (int64_t)ret_conv;
20787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20788 LDKDecodeError e_conv;
20789 e_conv.inner = (void*)(e & (~1));
20790 e_conv.is_owned = (e & 1) || (e == 0);
20791 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20792 e_conv = DecodeError_clone(&e_conv);
20793 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20794 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
20795 return (int64_t)ret_conv;
20798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20799 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
20800 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
20804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20805 if ((_res & 1) != 0) return;
20806 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20807 CHECK_ACCESS(_res_ptr);
20808 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
20810 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
20813 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
20814 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20815 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
20816 return (int64_t)ret_conv;
20818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20819 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
20820 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
20824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20825 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
20826 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20827 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
20828 return (int64_t)ret_conv;
20831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20832 LDKNetworkGraph o_conv;
20833 o_conv.inner = (void*)(o & (~1));
20834 o_conv.is_owned = (o & 1) || (o == 0);
20835 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20836 o_conv = NetworkGraph_clone(&o_conv);
20837 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20838 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
20839 return (int64_t)ret_conv;
20842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20843 LDKDecodeError e_conv;
20844 e_conv.inner = (void*)(e & (~1));
20845 e_conv.is_owned = (e & 1) || (e == 0);
20846 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20847 e_conv = DecodeError_clone(&e_conv);
20848 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20849 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
20850 return (int64_t)ret_conv;
20853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20854 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
20855 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
20859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20860 if ((_res & 1) != 0) return;
20861 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20862 CHECK_ACCESS(_res_ptr);
20863 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
20865 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
20868 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
20869 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20870 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
20871 return (int64_t)ret_conv;
20873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20874 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
20875 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
20879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20880 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
20881 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20882 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
20883 return (int64_t)ret_conv;
20886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
20887 LDKCVec_NetAddressZ o_constr;
20888 o_constr.datalen = (*env)->GetArrayLength(env, o);
20889 if (o_constr.datalen > 0)
20890 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20892 o_constr.data = NULL;
20893 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
20894 for (size_t m = 0; m < o_constr.datalen; m++) {
20895 int64_t o_conv_12 = o_vals[m];
20896 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
20897 CHECK_ACCESS(o_conv_12_ptr);
20898 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
20899 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
20900 o_constr.data[m] = o_conv_12_conv;
20902 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
20903 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20904 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
20905 int64_t ret_ref = (uintptr_t)ret_copy;
20909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
20910 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20911 *ret_copy = COption_CVec_NetAddressZZ_none();
20912 int64_t ret_ref = (uintptr_t)ret_copy;
20916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20917 if ((_res & 1) != 0) return;
20918 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20919 CHECK_ACCESS(_res_ptr);
20920 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
20922 COption_CVec_NetAddressZZ_free(_res_conv);
20925 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
20926 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20927 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
20928 int64_t ret_ref = (uintptr_t)ret_copy;
20931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20932 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
20933 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
20937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20938 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
20939 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20940 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
20941 int64_t ret_ref = (uintptr_t)ret_copy;
20945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20946 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20947 CHECK_ACCESS(o_ptr);
20948 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20949 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
20950 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20951 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
20952 return (int64_t)ret_conv;
20955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20956 LDKDecodeError e_conv;
20957 e_conv.inner = (void*)(e & (~1));
20958 e_conv.is_owned = (e & 1) || (e == 0);
20959 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20960 e_conv = DecodeError_clone(&e_conv);
20961 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20962 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
20963 return (int64_t)ret_conv;
20966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20967 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
20968 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
20972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20973 if ((_res & 1) != 0) return;
20974 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20975 CHECK_ACCESS(_res_ptr);
20976 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
20978 CResult_NetAddressDecodeErrorZ_free(_res_conv);
20981 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
20982 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20983 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
20984 return (int64_t)ret_conv;
20986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20987 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
20988 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
20992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20993 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
20994 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20995 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
20996 return (int64_t)ret_conv;
20999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21000 LDKCVec_UpdateAddHTLCZ _res_constr;
21001 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21002 if (_res_constr.datalen > 0)
21003 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21005 _res_constr.data = NULL;
21006 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21007 for (size_t p = 0; p < _res_constr.datalen; p++) {
21008 int64_t _res_conv_15 = _res_vals[p];
21009 LDKUpdateAddHTLC _res_conv_15_conv;
21010 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
21011 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
21012 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
21013 _res_constr.data[p] = _res_conv_15_conv;
21015 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21016 CVec_UpdateAddHTLCZ_free(_res_constr);
21019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21020 LDKCVec_UpdateFulfillHTLCZ _res_constr;
21021 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21022 if (_res_constr.datalen > 0)
21023 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21025 _res_constr.data = NULL;
21026 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21027 for (size_t t = 0; t < _res_constr.datalen; t++) {
21028 int64_t _res_conv_19 = _res_vals[t];
21029 LDKUpdateFulfillHTLC _res_conv_19_conv;
21030 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
21031 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
21032 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21033 _res_constr.data[t] = _res_conv_19_conv;
21035 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21036 CVec_UpdateFulfillHTLCZ_free(_res_constr);
21039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21040 LDKCVec_UpdateFailHTLCZ _res_constr;
21041 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21042 if (_res_constr.datalen > 0)
21043 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21045 _res_constr.data = NULL;
21046 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21047 for (size_t q = 0; q < _res_constr.datalen; q++) {
21048 int64_t _res_conv_16 = _res_vals[q];
21049 LDKUpdateFailHTLC _res_conv_16_conv;
21050 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
21051 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
21052 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21053 _res_constr.data[q] = _res_conv_16_conv;
21055 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21056 CVec_UpdateFailHTLCZ_free(_res_constr);
21059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21060 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
21061 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21062 if (_res_constr.datalen > 0)
21063 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21065 _res_constr.data = NULL;
21066 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21067 for (size_t z = 0; z < _res_constr.datalen; z++) {
21068 int64_t _res_conv_25 = _res_vals[z];
21069 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
21070 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
21071 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
21072 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
21073 _res_constr.data[z] = _res_conv_25_conv;
21075 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21076 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
21079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21080 LDKAcceptChannel o_conv;
21081 o_conv.inner = (void*)(o & (~1));
21082 o_conv.is_owned = (o & 1) || (o == 0);
21083 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21084 o_conv = AcceptChannel_clone(&o_conv);
21085 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21086 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
21087 return (int64_t)ret_conv;
21090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21091 LDKDecodeError e_conv;
21092 e_conv.inner = (void*)(e & (~1));
21093 e_conv.is_owned = (e & 1) || (e == 0);
21094 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21095 e_conv = DecodeError_clone(&e_conv);
21096 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21097 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
21098 return (int64_t)ret_conv;
21101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21102 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
21103 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
21107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21108 if ((_res & 1) != 0) return;
21109 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21110 CHECK_ACCESS(_res_ptr);
21111 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
21113 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
21116 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
21117 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21118 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
21119 return (int64_t)ret_conv;
21121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21122 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
21123 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
21127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21128 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
21129 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21130 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
21131 return (int64_t)ret_conv;
21134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21135 LDKAnnouncementSignatures o_conv;
21136 o_conv.inner = (void*)(o & (~1));
21137 o_conv.is_owned = (o & 1) || (o == 0);
21138 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21139 o_conv = AnnouncementSignatures_clone(&o_conv);
21140 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21141 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
21142 return (int64_t)ret_conv;
21145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21146 LDKDecodeError e_conv;
21147 e_conv.inner = (void*)(e & (~1));
21148 e_conv.is_owned = (e & 1) || (e == 0);
21149 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21150 e_conv = DecodeError_clone(&e_conv);
21151 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21152 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
21153 return (int64_t)ret_conv;
21156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21157 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
21158 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
21162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21163 if ((_res & 1) != 0) return;
21164 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21165 CHECK_ACCESS(_res_ptr);
21166 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
21168 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
21171 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
21172 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21173 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
21174 return (int64_t)ret_conv;
21176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21177 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
21178 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
21182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21183 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
21184 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21185 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
21186 return (int64_t)ret_conv;
21189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21190 LDKChannelReestablish o_conv;
21191 o_conv.inner = (void*)(o & (~1));
21192 o_conv.is_owned = (o & 1) || (o == 0);
21193 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21194 o_conv = ChannelReestablish_clone(&o_conv);
21195 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21196 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
21197 return (int64_t)ret_conv;
21200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21201 LDKDecodeError e_conv;
21202 e_conv.inner = (void*)(e & (~1));
21203 e_conv.is_owned = (e & 1) || (e == 0);
21204 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21205 e_conv = DecodeError_clone(&e_conv);
21206 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21207 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
21208 return (int64_t)ret_conv;
21211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21212 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
21213 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
21217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21218 if ((_res & 1) != 0) return;
21219 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21220 CHECK_ACCESS(_res_ptr);
21221 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
21223 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
21226 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
21227 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21228 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
21229 return (int64_t)ret_conv;
21231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21232 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
21233 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
21237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21238 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
21239 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21240 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
21241 return (int64_t)ret_conv;
21244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21245 LDKClosingSigned o_conv;
21246 o_conv.inner = (void*)(o & (~1));
21247 o_conv.is_owned = (o & 1) || (o == 0);
21248 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21249 o_conv = ClosingSigned_clone(&o_conv);
21250 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21251 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
21252 return (int64_t)ret_conv;
21255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21256 LDKDecodeError e_conv;
21257 e_conv.inner = (void*)(e & (~1));
21258 e_conv.is_owned = (e & 1) || (e == 0);
21259 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21260 e_conv = DecodeError_clone(&e_conv);
21261 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21262 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
21263 return (int64_t)ret_conv;
21266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21267 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
21268 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
21272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21273 if ((_res & 1) != 0) return;
21274 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21275 CHECK_ACCESS(_res_ptr);
21276 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
21278 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
21281 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
21282 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21283 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
21284 return (int64_t)ret_conv;
21286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21287 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
21288 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
21292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21293 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
21294 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21295 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
21296 return (int64_t)ret_conv;
21299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21300 LDKClosingSignedFeeRange o_conv;
21301 o_conv.inner = (void*)(o & (~1));
21302 o_conv.is_owned = (o & 1) || (o == 0);
21303 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21304 o_conv = ClosingSignedFeeRange_clone(&o_conv);
21305 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21306 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
21307 return (int64_t)ret_conv;
21310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21311 LDKDecodeError e_conv;
21312 e_conv.inner = (void*)(e & (~1));
21313 e_conv.is_owned = (e & 1) || (e == 0);
21314 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21315 e_conv = DecodeError_clone(&e_conv);
21316 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21317 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
21318 return (int64_t)ret_conv;
21321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21322 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
21323 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
21327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21328 if ((_res & 1) != 0) return;
21329 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21330 CHECK_ACCESS(_res_ptr);
21331 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
21333 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
21336 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
21337 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21338 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
21339 return (int64_t)ret_conv;
21341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21342 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
21343 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
21347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21348 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
21349 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21350 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
21351 return (int64_t)ret_conv;
21354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21355 LDKCommitmentSigned o_conv;
21356 o_conv.inner = (void*)(o & (~1));
21357 o_conv.is_owned = (o & 1) || (o == 0);
21358 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21359 o_conv = CommitmentSigned_clone(&o_conv);
21360 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21361 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
21362 return (int64_t)ret_conv;
21365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21366 LDKDecodeError e_conv;
21367 e_conv.inner = (void*)(e & (~1));
21368 e_conv.is_owned = (e & 1) || (e == 0);
21369 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21370 e_conv = DecodeError_clone(&e_conv);
21371 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21372 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
21373 return (int64_t)ret_conv;
21376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21377 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
21378 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
21382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21383 if ((_res & 1) != 0) return;
21384 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21385 CHECK_ACCESS(_res_ptr);
21386 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
21388 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
21391 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
21392 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21393 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
21394 return (int64_t)ret_conv;
21396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21397 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
21398 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
21402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21403 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
21404 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21405 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
21406 return (int64_t)ret_conv;
21409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21410 LDKFundingCreated o_conv;
21411 o_conv.inner = (void*)(o & (~1));
21412 o_conv.is_owned = (o & 1) || (o == 0);
21413 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21414 o_conv = FundingCreated_clone(&o_conv);
21415 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21416 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
21417 return (int64_t)ret_conv;
21420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21421 LDKDecodeError e_conv;
21422 e_conv.inner = (void*)(e & (~1));
21423 e_conv.is_owned = (e & 1) || (e == 0);
21424 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21425 e_conv = DecodeError_clone(&e_conv);
21426 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21427 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
21428 return (int64_t)ret_conv;
21431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21432 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
21433 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
21437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21438 if ((_res & 1) != 0) return;
21439 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21440 CHECK_ACCESS(_res_ptr);
21441 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
21443 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
21446 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
21447 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21448 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
21449 return (int64_t)ret_conv;
21451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21452 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
21453 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
21457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21458 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
21459 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21460 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
21461 return (int64_t)ret_conv;
21464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21465 LDKFundingSigned o_conv;
21466 o_conv.inner = (void*)(o & (~1));
21467 o_conv.is_owned = (o & 1) || (o == 0);
21468 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21469 o_conv = FundingSigned_clone(&o_conv);
21470 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21471 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
21472 return (int64_t)ret_conv;
21475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21476 LDKDecodeError e_conv;
21477 e_conv.inner = (void*)(e & (~1));
21478 e_conv.is_owned = (e & 1) || (e == 0);
21479 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21480 e_conv = DecodeError_clone(&e_conv);
21481 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21482 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
21483 return (int64_t)ret_conv;
21486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21487 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
21488 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
21492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21493 if ((_res & 1) != 0) return;
21494 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21495 CHECK_ACCESS(_res_ptr);
21496 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
21498 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
21501 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
21502 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21503 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
21504 return (int64_t)ret_conv;
21506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21507 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
21508 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
21512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21513 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
21514 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21515 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
21516 return (int64_t)ret_conv;
21519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21520 LDKFundingLocked o_conv;
21521 o_conv.inner = (void*)(o & (~1));
21522 o_conv.is_owned = (o & 1) || (o == 0);
21523 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21524 o_conv = FundingLocked_clone(&o_conv);
21525 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21526 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
21527 return (int64_t)ret_conv;
21530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21531 LDKDecodeError e_conv;
21532 e_conv.inner = (void*)(e & (~1));
21533 e_conv.is_owned = (e & 1) || (e == 0);
21534 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21535 e_conv = DecodeError_clone(&e_conv);
21536 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21537 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
21538 return (int64_t)ret_conv;
21541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21542 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
21543 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
21547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21548 if ((_res & 1) != 0) return;
21549 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21550 CHECK_ACCESS(_res_ptr);
21551 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
21553 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
21556 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
21557 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21558 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
21559 return (int64_t)ret_conv;
21561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21562 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
21563 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
21567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21568 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
21569 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21570 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
21571 return (int64_t)ret_conv;
21574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21576 o_conv.inner = (void*)(o & (~1));
21577 o_conv.is_owned = (o & 1) || (o == 0);
21578 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21579 o_conv = Init_clone(&o_conv);
21580 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21581 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
21582 return (int64_t)ret_conv;
21585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21586 LDKDecodeError e_conv;
21587 e_conv.inner = (void*)(e & (~1));
21588 e_conv.is_owned = (e & 1) || (e == 0);
21589 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21590 e_conv = DecodeError_clone(&e_conv);
21591 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21592 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
21593 return (int64_t)ret_conv;
21596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21597 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
21598 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
21602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21603 if ((_res & 1) != 0) return;
21604 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21605 CHECK_ACCESS(_res_ptr);
21606 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
21608 CResult_InitDecodeErrorZ_free(_res_conv);
21611 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
21612 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21613 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
21614 return (int64_t)ret_conv;
21616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21617 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
21618 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
21622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21623 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
21624 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21625 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
21626 return (int64_t)ret_conv;
21629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21630 LDKOpenChannel o_conv;
21631 o_conv.inner = (void*)(o & (~1));
21632 o_conv.is_owned = (o & 1) || (o == 0);
21633 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21634 o_conv = OpenChannel_clone(&o_conv);
21635 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21636 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
21637 return (int64_t)ret_conv;
21640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21641 LDKDecodeError e_conv;
21642 e_conv.inner = (void*)(e & (~1));
21643 e_conv.is_owned = (e & 1) || (e == 0);
21644 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21645 e_conv = DecodeError_clone(&e_conv);
21646 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21647 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
21648 return (int64_t)ret_conv;
21651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21652 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
21653 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
21657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21658 if ((_res & 1) != 0) return;
21659 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21660 CHECK_ACCESS(_res_ptr);
21661 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
21663 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
21666 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
21667 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21668 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
21669 return (int64_t)ret_conv;
21671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21672 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
21673 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
21677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21678 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
21679 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21680 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
21681 return (int64_t)ret_conv;
21684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21685 LDKRevokeAndACK o_conv;
21686 o_conv.inner = (void*)(o & (~1));
21687 o_conv.is_owned = (o & 1) || (o == 0);
21688 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21689 o_conv = RevokeAndACK_clone(&o_conv);
21690 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21691 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
21692 return (int64_t)ret_conv;
21695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21696 LDKDecodeError e_conv;
21697 e_conv.inner = (void*)(e & (~1));
21698 e_conv.is_owned = (e & 1) || (e == 0);
21699 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21700 e_conv = DecodeError_clone(&e_conv);
21701 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21702 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
21703 return (int64_t)ret_conv;
21706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21707 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
21708 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
21712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21713 if ((_res & 1) != 0) return;
21714 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21715 CHECK_ACCESS(_res_ptr);
21716 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
21718 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
21721 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
21722 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21723 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
21724 return (int64_t)ret_conv;
21726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21727 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
21728 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
21732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21733 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
21734 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21735 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
21736 return (int64_t)ret_conv;
21739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21740 LDKShutdown o_conv;
21741 o_conv.inner = (void*)(o & (~1));
21742 o_conv.is_owned = (o & 1) || (o == 0);
21743 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21744 o_conv = Shutdown_clone(&o_conv);
21745 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21746 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
21747 return (int64_t)ret_conv;
21750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21751 LDKDecodeError e_conv;
21752 e_conv.inner = (void*)(e & (~1));
21753 e_conv.is_owned = (e & 1) || (e == 0);
21754 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21755 e_conv = DecodeError_clone(&e_conv);
21756 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21757 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
21758 return (int64_t)ret_conv;
21761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21762 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
21763 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
21767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21768 if ((_res & 1) != 0) return;
21769 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21770 CHECK_ACCESS(_res_ptr);
21771 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
21773 CResult_ShutdownDecodeErrorZ_free(_res_conv);
21776 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
21777 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21778 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
21779 return (int64_t)ret_conv;
21781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21782 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
21783 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
21787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21788 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
21789 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21790 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
21791 return (int64_t)ret_conv;
21794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21795 LDKUpdateFailHTLC o_conv;
21796 o_conv.inner = (void*)(o & (~1));
21797 o_conv.is_owned = (o & 1) || (o == 0);
21798 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21799 o_conv = UpdateFailHTLC_clone(&o_conv);
21800 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21801 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
21802 return (int64_t)ret_conv;
21805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21806 LDKDecodeError e_conv;
21807 e_conv.inner = (void*)(e & (~1));
21808 e_conv.is_owned = (e & 1) || (e == 0);
21809 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21810 e_conv = DecodeError_clone(&e_conv);
21811 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21812 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
21813 return (int64_t)ret_conv;
21816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21817 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
21818 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
21822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21823 if ((_res & 1) != 0) return;
21824 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21825 CHECK_ACCESS(_res_ptr);
21826 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
21828 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
21831 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
21832 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21833 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
21834 return (int64_t)ret_conv;
21836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21837 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
21838 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
21842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21843 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
21844 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21845 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
21846 return (int64_t)ret_conv;
21849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21850 LDKUpdateFailMalformedHTLC o_conv;
21851 o_conv.inner = (void*)(o & (~1));
21852 o_conv.is_owned = (o & 1) || (o == 0);
21853 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21854 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
21855 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21856 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
21857 return (int64_t)ret_conv;
21860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21861 LDKDecodeError e_conv;
21862 e_conv.inner = (void*)(e & (~1));
21863 e_conv.is_owned = (e & 1) || (e == 0);
21864 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21865 e_conv = DecodeError_clone(&e_conv);
21866 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21867 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
21868 return (int64_t)ret_conv;
21871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21872 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
21873 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
21877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21878 if ((_res & 1) != 0) return;
21879 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21880 CHECK_ACCESS(_res_ptr);
21881 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
21883 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
21886 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
21887 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21888 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
21889 return (int64_t)ret_conv;
21891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21892 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
21893 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
21897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21898 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
21899 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21900 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
21901 return (int64_t)ret_conv;
21904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21905 LDKUpdateFee o_conv;
21906 o_conv.inner = (void*)(o & (~1));
21907 o_conv.is_owned = (o & 1) || (o == 0);
21908 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21909 o_conv = UpdateFee_clone(&o_conv);
21910 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21911 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
21912 return (int64_t)ret_conv;
21915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21916 LDKDecodeError e_conv;
21917 e_conv.inner = (void*)(e & (~1));
21918 e_conv.is_owned = (e & 1) || (e == 0);
21919 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21920 e_conv = DecodeError_clone(&e_conv);
21921 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21922 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
21923 return (int64_t)ret_conv;
21926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21927 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
21928 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
21932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21933 if ((_res & 1) != 0) return;
21934 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21935 CHECK_ACCESS(_res_ptr);
21936 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
21938 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
21941 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
21942 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21943 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
21944 return (int64_t)ret_conv;
21946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21947 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
21948 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
21952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21953 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
21954 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21955 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
21956 return (int64_t)ret_conv;
21959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21960 LDKUpdateFulfillHTLC o_conv;
21961 o_conv.inner = (void*)(o & (~1));
21962 o_conv.is_owned = (o & 1) || (o == 0);
21963 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21964 o_conv = UpdateFulfillHTLC_clone(&o_conv);
21965 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21966 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
21967 return (int64_t)ret_conv;
21970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21971 LDKDecodeError e_conv;
21972 e_conv.inner = (void*)(e & (~1));
21973 e_conv.is_owned = (e & 1) || (e == 0);
21974 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21975 e_conv = DecodeError_clone(&e_conv);
21976 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21977 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
21978 return (int64_t)ret_conv;
21981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21982 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
21983 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
21987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21988 if ((_res & 1) != 0) return;
21989 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21990 CHECK_ACCESS(_res_ptr);
21991 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
21993 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
21996 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
21997 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21998 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
21999 return (int64_t)ret_conv;
22001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22002 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
22003 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
22007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22008 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
22009 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22010 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
22011 return (int64_t)ret_conv;
22014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22015 LDKUpdateAddHTLC o_conv;
22016 o_conv.inner = (void*)(o & (~1));
22017 o_conv.is_owned = (o & 1) || (o == 0);
22018 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22019 o_conv = UpdateAddHTLC_clone(&o_conv);
22020 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22021 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
22022 return (int64_t)ret_conv;
22025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22026 LDKDecodeError e_conv;
22027 e_conv.inner = (void*)(e & (~1));
22028 e_conv.is_owned = (e & 1) || (e == 0);
22029 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22030 e_conv = DecodeError_clone(&e_conv);
22031 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22032 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
22033 return (int64_t)ret_conv;
22036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22037 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
22038 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
22042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22043 if ((_res & 1) != 0) return;
22044 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22045 CHECK_ACCESS(_res_ptr);
22046 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
22048 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
22051 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
22052 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22053 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
22054 return (int64_t)ret_conv;
22056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22057 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
22058 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
22062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22063 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
22064 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22065 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
22066 return (int64_t)ret_conv;
22069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22071 o_conv.inner = (void*)(o & (~1));
22072 o_conv.is_owned = (o & 1) || (o == 0);
22073 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22074 o_conv = Ping_clone(&o_conv);
22075 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22076 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
22077 return (int64_t)ret_conv;
22080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22081 LDKDecodeError e_conv;
22082 e_conv.inner = (void*)(e & (~1));
22083 e_conv.is_owned = (e & 1) || (e == 0);
22084 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22085 e_conv = DecodeError_clone(&e_conv);
22086 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22087 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
22088 return (int64_t)ret_conv;
22091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22092 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
22093 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
22097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22098 if ((_res & 1) != 0) return;
22099 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22100 CHECK_ACCESS(_res_ptr);
22101 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
22103 CResult_PingDecodeErrorZ_free(_res_conv);
22106 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
22107 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22108 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
22109 return (int64_t)ret_conv;
22111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22112 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
22113 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
22117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22118 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
22119 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22120 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
22121 return (int64_t)ret_conv;
22124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22126 o_conv.inner = (void*)(o & (~1));
22127 o_conv.is_owned = (o & 1) || (o == 0);
22128 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22129 o_conv = Pong_clone(&o_conv);
22130 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22131 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
22132 return (int64_t)ret_conv;
22135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22136 LDKDecodeError e_conv;
22137 e_conv.inner = (void*)(e & (~1));
22138 e_conv.is_owned = (e & 1) || (e == 0);
22139 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22140 e_conv = DecodeError_clone(&e_conv);
22141 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22142 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
22143 return (int64_t)ret_conv;
22146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22147 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
22148 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
22152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22153 if ((_res & 1) != 0) return;
22154 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22155 CHECK_ACCESS(_res_ptr);
22156 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
22158 CResult_PongDecodeErrorZ_free(_res_conv);
22161 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
22162 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22163 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
22164 return (int64_t)ret_conv;
22166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22167 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
22168 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
22172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22173 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
22174 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22175 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
22176 return (int64_t)ret_conv;
22179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22180 LDKUnsignedChannelAnnouncement o_conv;
22181 o_conv.inner = (void*)(o & (~1));
22182 o_conv.is_owned = (o & 1) || (o == 0);
22183 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22184 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
22185 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22186 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
22187 return (int64_t)ret_conv;
22190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22191 LDKDecodeError e_conv;
22192 e_conv.inner = (void*)(e & (~1));
22193 e_conv.is_owned = (e & 1) || (e == 0);
22194 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22195 e_conv = DecodeError_clone(&e_conv);
22196 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22197 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
22198 return (int64_t)ret_conv;
22201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22202 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
22203 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22208 if ((_res & 1) != 0) return;
22209 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22210 CHECK_ACCESS(_res_ptr);
22211 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22213 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
22216 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22217 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22218 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
22219 return (int64_t)ret_conv;
22221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22222 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
22223 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22228 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
22229 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22230 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22231 return (int64_t)ret_conv;
22234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22235 LDKChannelAnnouncement o_conv;
22236 o_conv.inner = (void*)(o & (~1));
22237 o_conv.is_owned = (o & 1) || (o == 0);
22238 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22239 o_conv = ChannelAnnouncement_clone(&o_conv);
22240 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22241 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
22242 return (int64_t)ret_conv;
22245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22246 LDKDecodeError e_conv;
22247 e_conv.inner = (void*)(e & (~1));
22248 e_conv.is_owned = (e & 1) || (e == 0);
22249 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22250 e_conv = DecodeError_clone(&e_conv);
22251 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22252 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
22253 return (int64_t)ret_conv;
22256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22257 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
22258 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22263 if ((_res & 1) != 0) return;
22264 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22265 CHECK_ACCESS(_res_ptr);
22266 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22268 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
22271 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22272 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22273 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
22274 return (int64_t)ret_conv;
22276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22277 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
22278 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22283 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
22284 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22285 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22286 return (int64_t)ret_conv;
22289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22290 LDKUnsignedChannelUpdate o_conv;
22291 o_conv.inner = (void*)(o & (~1));
22292 o_conv.is_owned = (o & 1) || (o == 0);
22293 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22294 o_conv = UnsignedChannelUpdate_clone(&o_conv);
22295 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22296 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
22297 return (int64_t)ret_conv;
22300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22301 LDKDecodeError e_conv;
22302 e_conv.inner = (void*)(e & (~1));
22303 e_conv.is_owned = (e & 1) || (e == 0);
22304 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22305 e_conv = DecodeError_clone(&e_conv);
22306 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22307 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
22308 return (int64_t)ret_conv;
22311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22312 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
22313 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
22317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22318 if ((_res & 1) != 0) return;
22319 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22320 CHECK_ACCESS(_res_ptr);
22321 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
22323 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
22326 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22327 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22328 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
22329 return (int64_t)ret_conv;
22331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22332 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
22333 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22338 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
22339 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22340 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
22341 return (int64_t)ret_conv;
22344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22345 LDKChannelUpdate o_conv;
22346 o_conv.inner = (void*)(o & (~1));
22347 o_conv.is_owned = (o & 1) || (o == 0);
22348 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22349 o_conv = ChannelUpdate_clone(&o_conv);
22350 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22351 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
22352 return (int64_t)ret_conv;
22355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22356 LDKDecodeError e_conv;
22357 e_conv.inner = (void*)(e & (~1));
22358 e_conv.is_owned = (e & 1) || (e == 0);
22359 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22360 e_conv = DecodeError_clone(&e_conv);
22361 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22362 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
22363 return (int64_t)ret_conv;
22366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22367 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
22368 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
22372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22373 if ((_res & 1) != 0) return;
22374 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22375 CHECK_ACCESS(_res_ptr);
22376 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
22378 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
22381 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22382 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22383 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
22384 return (int64_t)ret_conv;
22386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22387 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
22388 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22393 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
22394 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22395 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
22396 return (int64_t)ret_conv;
22399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22400 LDKErrorMessage o_conv;
22401 o_conv.inner = (void*)(o & (~1));
22402 o_conv.is_owned = (o & 1) || (o == 0);
22403 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22404 o_conv = ErrorMessage_clone(&o_conv);
22405 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22406 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
22407 return (int64_t)ret_conv;
22410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22411 LDKDecodeError e_conv;
22412 e_conv.inner = (void*)(e & (~1));
22413 e_conv.is_owned = (e & 1) || (e == 0);
22414 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22415 e_conv = DecodeError_clone(&e_conv);
22416 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22417 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
22418 return (int64_t)ret_conv;
22421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22422 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
22423 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
22427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22428 if ((_res & 1) != 0) return;
22429 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22430 CHECK_ACCESS(_res_ptr);
22431 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
22433 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
22436 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
22437 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22438 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
22439 return (int64_t)ret_conv;
22441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22442 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
22443 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
22447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22448 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
22449 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22450 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
22451 return (int64_t)ret_conv;
22454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22455 LDKWarningMessage o_conv;
22456 o_conv.inner = (void*)(o & (~1));
22457 o_conv.is_owned = (o & 1) || (o == 0);
22458 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22459 o_conv = WarningMessage_clone(&o_conv);
22460 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22461 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
22462 return (int64_t)ret_conv;
22465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22466 LDKDecodeError e_conv;
22467 e_conv.inner = (void*)(e & (~1));
22468 e_conv.is_owned = (e & 1) || (e == 0);
22469 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22470 e_conv = DecodeError_clone(&e_conv);
22471 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22472 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
22473 return (int64_t)ret_conv;
22476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22477 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
22478 jboolean ret_val = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
22482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22483 if ((_res & 1) != 0) return;
22484 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22485 CHECK_ACCESS(_res_ptr);
22486 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
22488 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
22491 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
22492 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22493 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
22494 return (int64_t)ret_conv;
22496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22497 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
22498 int64_t ret_val = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
22502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22503 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
22504 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22505 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
22506 return (int64_t)ret_conv;
22509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22510 LDKUnsignedNodeAnnouncement o_conv;
22511 o_conv.inner = (void*)(o & (~1));
22512 o_conv.is_owned = (o & 1) || (o == 0);
22513 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22514 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
22515 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22516 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
22517 return (int64_t)ret_conv;
22520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22521 LDKDecodeError e_conv;
22522 e_conv.inner = (void*)(e & (~1));
22523 e_conv.is_owned = (e & 1) || (e == 0);
22524 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22525 e_conv = DecodeError_clone(&e_conv);
22526 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22527 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
22528 return (int64_t)ret_conv;
22531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22532 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
22533 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22538 if ((_res & 1) != 0) return;
22539 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22540 CHECK_ACCESS(_res_ptr);
22541 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
22543 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
22546 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22547 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22548 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
22549 return (int64_t)ret_conv;
22551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22552 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
22553 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22558 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
22559 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22560 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
22561 return (int64_t)ret_conv;
22564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22565 LDKNodeAnnouncement o_conv;
22566 o_conv.inner = (void*)(o & (~1));
22567 o_conv.is_owned = (o & 1) || (o == 0);
22568 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22569 o_conv = NodeAnnouncement_clone(&o_conv);
22570 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22571 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
22572 return (int64_t)ret_conv;
22575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22576 LDKDecodeError e_conv;
22577 e_conv.inner = (void*)(e & (~1));
22578 e_conv.is_owned = (e & 1) || (e == 0);
22579 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22580 e_conv = DecodeError_clone(&e_conv);
22581 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22582 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
22583 return (int64_t)ret_conv;
22586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22587 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
22588 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22593 if ((_res & 1) != 0) return;
22594 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22595 CHECK_ACCESS(_res_ptr);
22596 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
22598 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
22601 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22602 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22603 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
22604 return (int64_t)ret_conv;
22606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22607 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
22608 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22613 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
22614 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22615 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
22616 return (int64_t)ret_conv;
22619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22620 LDKQueryShortChannelIds o_conv;
22621 o_conv.inner = (void*)(o & (~1));
22622 o_conv.is_owned = (o & 1) || (o == 0);
22623 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22624 o_conv = QueryShortChannelIds_clone(&o_conv);
22625 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22626 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
22627 return (int64_t)ret_conv;
22630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22631 LDKDecodeError e_conv;
22632 e_conv.inner = (void*)(e & (~1));
22633 e_conv.is_owned = (e & 1) || (e == 0);
22634 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22635 e_conv = DecodeError_clone(&e_conv);
22636 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22637 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
22638 return (int64_t)ret_conv;
22641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22642 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
22643 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
22647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22648 if ((_res & 1) != 0) return;
22649 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22650 CHECK_ACCESS(_res_ptr);
22651 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
22653 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
22656 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
22657 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22658 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
22659 return (int64_t)ret_conv;
22661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22662 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
22663 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
22667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22668 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
22669 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22670 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
22671 return (int64_t)ret_conv;
22674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22675 LDKReplyShortChannelIdsEnd o_conv;
22676 o_conv.inner = (void*)(o & (~1));
22677 o_conv.is_owned = (o & 1) || (o == 0);
22678 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22679 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
22680 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22681 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
22682 return (int64_t)ret_conv;
22685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22686 LDKDecodeError e_conv;
22687 e_conv.inner = (void*)(e & (~1));
22688 e_conv.is_owned = (e & 1) || (e == 0);
22689 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22690 e_conv = DecodeError_clone(&e_conv);
22691 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22692 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
22693 return (int64_t)ret_conv;
22696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22697 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
22698 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
22702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22703 if ((_res & 1) != 0) return;
22704 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22705 CHECK_ACCESS(_res_ptr);
22706 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
22708 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
22711 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
22712 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22713 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
22714 return (int64_t)ret_conv;
22716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22717 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
22718 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
22722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22723 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
22724 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22725 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
22726 return (int64_t)ret_conv;
22729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22730 LDKQueryChannelRange o_conv;
22731 o_conv.inner = (void*)(o & (~1));
22732 o_conv.is_owned = (o & 1) || (o == 0);
22733 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22734 o_conv = QueryChannelRange_clone(&o_conv);
22735 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22736 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
22737 return (int64_t)ret_conv;
22740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22741 LDKDecodeError e_conv;
22742 e_conv.inner = (void*)(e & (~1));
22743 e_conv.is_owned = (e & 1) || (e == 0);
22744 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22745 e_conv = DecodeError_clone(&e_conv);
22746 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22747 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
22748 return (int64_t)ret_conv;
22751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22752 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
22753 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
22757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22758 if ((_res & 1) != 0) return;
22759 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22760 CHECK_ACCESS(_res_ptr);
22761 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
22763 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
22766 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22767 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22768 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
22769 return (int64_t)ret_conv;
22771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22772 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
22773 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22778 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
22779 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22780 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
22781 return (int64_t)ret_conv;
22784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22785 LDKReplyChannelRange o_conv;
22786 o_conv.inner = (void*)(o & (~1));
22787 o_conv.is_owned = (o & 1) || (o == 0);
22788 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22789 o_conv = ReplyChannelRange_clone(&o_conv);
22790 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22791 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
22792 return (int64_t)ret_conv;
22795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22796 LDKDecodeError e_conv;
22797 e_conv.inner = (void*)(e & (~1));
22798 e_conv.is_owned = (e & 1) || (e == 0);
22799 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22800 e_conv = DecodeError_clone(&e_conv);
22801 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22802 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
22803 return (int64_t)ret_conv;
22806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22807 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
22808 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
22812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22813 if ((_res & 1) != 0) return;
22814 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22815 CHECK_ACCESS(_res_ptr);
22816 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
22818 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
22821 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22822 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22823 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
22824 return (int64_t)ret_conv;
22826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22827 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
22828 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22833 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
22834 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22835 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
22836 return (int64_t)ret_conv;
22839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22840 LDKGossipTimestampFilter o_conv;
22841 o_conv.inner = (void*)(o & (~1));
22842 o_conv.is_owned = (o & 1) || (o == 0);
22843 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22844 o_conv = GossipTimestampFilter_clone(&o_conv);
22845 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22846 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
22847 return (int64_t)ret_conv;
22850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22851 LDKDecodeError e_conv;
22852 e_conv.inner = (void*)(e & (~1));
22853 e_conv.is_owned = (e & 1) || (e == 0);
22854 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22855 e_conv = DecodeError_clone(&e_conv);
22856 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22857 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
22858 return (int64_t)ret_conv;
22861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22862 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
22863 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
22867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22868 if ((_res & 1) != 0) return;
22869 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22870 CHECK_ACCESS(_res_ptr);
22871 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
22873 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
22876 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
22877 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22878 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
22879 return (int64_t)ret_conv;
22881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22882 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
22883 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
22887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22888 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
22889 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22890 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
22891 return (int64_t)ret_conv;
22894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22895 LDKCVec_PhantomRouteHintsZ _res_constr;
22896 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22897 if (_res_constr.datalen > 0)
22898 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22900 _res_constr.data = NULL;
22901 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22902 for (size_t t = 0; t < _res_constr.datalen; t++) {
22903 int64_t _res_conv_19 = _res_vals[t];
22904 LDKPhantomRouteHints _res_conv_19_conv;
22905 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
22906 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
22907 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22908 _res_constr.data[t] = _res_conv_19_conv;
22910 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22911 CVec_PhantomRouteHintsZ_free(_res_constr);
22914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22916 o_conv.inner = (void*)(o & (~1));
22917 o_conv.is_owned = (o & 1) || (o == 0);
22918 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22919 o_conv = Invoice_clone(&o_conv);
22920 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22921 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22922 return (int64_t)ret_conv;
22925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22926 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
22927 CHECK_ACCESS(e_ptr);
22928 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22929 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
22930 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22931 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22932 return (int64_t)ret_conv;
22935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22936 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
22937 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22942 if ((_res & 1) != 0) return;
22943 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22944 CHECK_ACCESS(_res_ptr);
22945 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22947 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22950 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22951 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22952 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22953 return (int64_t)ret_conv;
22955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22956 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
22957 int64_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22962 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
22963 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22964 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22965 return (int64_t)ret_conv;
22968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22969 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
22970 CHECK_ACCESS(o_ptr);
22971 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
22972 if (o_conv.free == LDKFilter_JCalls_free) {
22973 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22974 LDKFilter_JCalls_cloned(&o_conv);
22976 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22977 *ret_copy = COption_FilterZ_some(o_conv);
22978 int64_t ret_ref = (uintptr_t)ret_copy;
22982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
22983 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22984 *ret_copy = COption_FilterZ_none();
22985 int64_t ret_ref = (uintptr_t)ret_copy;
22989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22990 if ((_res & 1) != 0) return;
22991 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22992 CHECK_ACCESS(_res_ptr);
22993 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
22995 COption_FilterZ_free(_res_conv);
22998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22999 LDKLockedChannelMonitor o_conv;
23000 o_conv.inner = (void*)(o & (~1));
23001 o_conv.is_owned = (o & 1) || (o == 0);
23002 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23003 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
23004 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23005 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
23006 return (int64_t)ret_conv;
23009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
23010 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23011 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
23012 return (int64_t)ret_conv;
23015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23016 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
23017 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
23021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23022 if ((_res & 1) != 0) return;
23023 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23024 CHECK_ACCESS(_res_ptr);
23025 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
23027 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
23030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23031 LDKCVec_OutPointZ _res_constr;
23032 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23033 if (_res_constr.datalen > 0)
23034 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
23036 _res_constr.data = NULL;
23037 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23038 for (size_t k = 0; k < _res_constr.datalen; k++) {
23039 int64_t _res_conv_10 = _res_vals[k];
23040 LDKOutPoint _res_conv_10_conv;
23041 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
23042 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
23043 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23044 _res_constr.data[k] = _res_conv_10_conv;
23046 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23047 CVec_OutPointZ_free(_res_constr);
23050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23051 if ((this_ptr & 1) != 0) return;
23052 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23053 CHECK_ACCESS(this_ptr_ptr);
23054 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
23055 FREE((void*)this_ptr);
23056 PaymentPurpose_free(this_ptr_conv);
23059 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
23060 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23061 *ret_copy = PaymentPurpose_clone(arg);
23062 int64_t ret_ref = (uintptr_t)ret_copy;
23065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23066 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
23067 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
23071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23072 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
23073 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23074 *ret_copy = PaymentPurpose_clone(orig_conv);
23075 int64_t ret_ref = (uintptr_t)ret_copy;
23079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
23080 LDKThirtyTwoBytes payment_preimage_ref;
23081 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23082 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23083 LDKThirtyTwoBytes payment_secret_ref;
23084 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
23085 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
23086 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23087 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
23088 int64_t ret_ref = (uintptr_t)ret_copy;
23092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
23093 LDKThirtyTwoBytes a_ref;
23094 CHECK((*env)->GetArrayLength(env, a) == 32);
23095 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23096 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23097 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
23098 int64_t ret_ref = (uintptr_t)ret_copy;
23102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23103 if ((this_ptr & 1) != 0) return;
23104 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23105 CHECK_ACCESS(this_ptr_ptr);
23106 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
23107 FREE((void*)this_ptr);
23108 ClosureReason_free(this_ptr_conv);
23111 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
23112 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23113 *ret_copy = ClosureReason_clone(arg);
23114 int64_t ret_ref = (uintptr_t)ret_copy;
23117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23118 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
23119 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
23123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23124 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
23125 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23126 *ret_copy = ClosureReason_clone(orig_conv);
23127 int64_t ret_ref = (uintptr_t)ret_copy;
23131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
23132 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
23133 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23134 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
23135 int64_t ret_ref = (uintptr_t)ret_copy;
23139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
23140 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23141 *ret_copy = ClosureReason_holder_force_closed();
23142 int64_t ret_ref = (uintptr_t)ret_copy;
23146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
23147 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23148 *ret_copy = ClosureReason_cooperative_closure();
23149 int64_t ret_ref = (uintptr_t)ret_copy;
23153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
23154 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23155 *ret_copy = ClosureReason_commitment_tx_confirmed();
23156 int64_t ret_ref = (uintptr_t)ret_copy;
23160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
23161 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23162 *ret_copy = ClosureReason_funding_timed_out();
23163 int64_t ret_ref = (uintptr_t)ret_copy;
23167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
23168 LDKStr err_conv = java_to_owned_str(env, err);
23169 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23170 *ret_copy = ClosureReason_processing_error(err_conv);
23171 int64_t ret_ref = (uintptr_t)ret_copy;
23175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
23176 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23177 *ret_copy = ClosureReason_disconnected_peer();
23178 int64_t ret_ref = (uintptr_t)ret_copy;
23182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
23183 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23184 *ret_copy = ClosureReason_outdated_channel_manager();
23185 int64_t ret_ref = (uintptr_t)ret_copy;
23189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
23190 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
23191 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
23192 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23193 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23194 CVec_u8Z_free(ret_var);
23198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23199 LDKu8slice ser_ref;
23200 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23201 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23202 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
23203 *ret_conv = ClosureReason_read(ser_ref);
23204 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23205 return (int64_t)ret_conv;
23208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23209 if ((this_ptr & 1) != 0) return;
23210 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23211 CHECK_ACCESS(this_ptr_ptr);
23212 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
23213 FREE((void*)this_ptr);
23214 Event_free(this_ptr_conv);
23217 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
23218 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23219 *ret_copy = Event_clone(arg);
23220 int64_t ret_ref = (uintptr_t)ret_copy;
23223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23224 LDKEvent* arg_conv = (LDKEvent*)arg;
23225 int64_t ret_val = Event_clone_ptr(arg_conv);
23229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23230 LDKEvent* orig_conv = (LDKEvent*)orig;
23231 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23232 *ret_copy = Event_clone(orig_conv);
23233 int64_t ret_ref = (uintptr_t)ret_copy;
23237 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) {
23238 LDKThirtyTwoBytes temporary_channel_id_ref;
23239 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23240 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23241 LDKCVec_u8Z output_script_ref;
23242 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
23243 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
23244 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
23245 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23246 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
23247 int64_t ret_ref = (uintptr_t)ret_copy;
23251 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) {
23252 LDKThirtyTwoBytes payment_hash_ref;
23253 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23254 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23255 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
23256 CHECK_ACCESS(purpose_ptr);
23257 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23258 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
23259 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23260 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
23261 int64_t ret_ref = (uintptr_t)ret_copy;
23265 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) {
23266 LDKThirtyTwoBytes payment_id_ref;
23267 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23268 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23269 LDKThirtyTwoBytes payment_preimage_ref;
23270 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23271 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23272 LDKThirtyTwoBytes payment_hash_ref;
23273 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23274 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23275 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
23276 CHECK_ACCESS(fee_paid_msat_ptr);
23277 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
23278 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
23279 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23280 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
23281 int64_t ret_ref = (uintptr_t)ret_copy;
23285 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) {
23286 LDKThirtyTwoBytes payment_id_ref;
23287 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23288 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23289 LDKThirtyTwoBytes payment_hash_ref;
23290 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23291 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23292 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
23293 CHECK_ACCESS(network_update_ptr);
23294 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
23295 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
23296 LDKCVec_RouteHopZ path_constr;
23297 path_constr.datalen = (*env)->GetArrayLength(env, path);
23298 if (path_constr.datalen > 0)
23299 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23301 path_constr.data = NULL;
23302 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23303 for (size_t k = 0; k < path_constr.datalen; k++) {
23304 int64_t path_conv_10 = path_vals[k];
23305 LDKRouteHop path_conv_10_conv;
23306 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
23307 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
23308 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23309 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23310 path_constr.data[k] = path_conv_10_conv;
23312 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23313 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
23314 CHECK_ACCESS(short_channel_id_ptr);
23315 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23316 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
23317 LDKRouteParameters retry_conv;
23318 retry_conv.inner = (void*)(retry & (~1));
23319 retry_conv.is_owned = (retry & 1) || (retry == 0);
23320 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
23321 retry_conv = RouteParameters_clone(&retry_conv);
23322 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23323 *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);
23324 int64_t ret_ref = (uintptr_t)ret_copy;
23328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
23329 LDKThirtyTwoBytes payment_id_ref;
23330 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23331 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23332 LDKThirtyTwoBytes payment_hash_ref;
23333 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23334 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23335 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23336 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
23337 int64_t ret_ref = (uintptr_t)ret_copy;
23341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
23342 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23343 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
23344 int64_t ret_ref = (uintptr_t)ret_copy;
23348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
23349 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
23350 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
23351 if (outputs_constr.datalen > 0)
23352 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23354 outputs_constr.data = NULL;
23355 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
23356 for (size_t b = 0; b < outputs_constr.datalen; b++) {
23357 int64_t outputs_conv_27 = outputs_vals[b];
23358 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
23359 CHECK_ACCESS(outputs_conv_27_ptr);
23360 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
23361 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
23362 outputs_constr.data[b] = outputs_conv_27_conv;
23364 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
23365 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23366 *ret_copy = Event_spendable_outputs(outputs_constr);
23367 int64_t ret_ref = (uintptr_t)ret_copy;
23371 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) {
23372 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
23373 CHECK_ACCESS(fee_earned_msat_ptr);
23374 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
23375 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
23376 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23377 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
23378 int64_t ret_ref = (uintptr_t)ret_copy;
23382 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) {
23383 LDKThirtyTwoBytes channel_id_ref;
23384 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23385 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23386 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
23387 CHECK_ACCESS(reason_ptr);
23388 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
23389 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
23390 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23391 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
23392 int64_t ret_ref = (uintptr_t)ret_copy;
23396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
23397 LDKThirtyTwoBytes channel_id_ref;
23398 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23399 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23400 LDKTransaction transaction_ref;
23401 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
23402 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
23403 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
23404 transaction_ref.data_is_owned = true;
23405 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23406 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
23407 int64_t ret_ref = (uintptr_t)ret_copy;
23411 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) {
23412 LDKThirtyTwoBytes payment_id_ref;
23413 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23414 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23415 LDKThirtyTwoBytes payment_hash_ref;
23416 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23417 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23418 LDKCVec_RouteHopZ path_constr;
23419 path_constr.datalen = (*env)->GetArrayLength(env, path);
23420 if (path_constr.datalen > 0)
23421 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23423 path_constr.data = NULL;
23424 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23425 for (size_t k = 0; k < path_constr.datalen; k++) {
23426 int64_t path_conv_10 = path_vals[k];
23427 LDKRouteHop path_conv_10_conv;
23428 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
23429 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
23430 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23431 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23432 path_constr.data[k] = path_conv_10_conv;
23434 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23435 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23436 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
23437 int64_t ret_ref = (uintptr_t)ret_copy;
23441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
23442 LDKThirtyTwoBytes temporary_channel_id_ref;
23443 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23444 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23445 LDKPublicKey counterparty_node_id_ref;
23446 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23447 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23448 LDKChannelTypeFeatures channel_type_conv;
23449 channel_type_conv.inner = (void*)(channel_type & (~1));
23450 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
23451 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
23452 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
23453 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23454 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
23455 int64_t ret_ref = (uintptr_t)ret_copy;
23459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
23460 LDKEvent* obj_conv = (LDKEvent*)obj;
23461 LDKCVec_u8Z ret_var = Event_write(obj_conv);
23462 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23463 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23464 CVec_u8Z_free(ret_var);
23468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23469 LDKu8slice ser_ref;
23470 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23471 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23472 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
23473 *ret_conv = Event_read(ser_ref);
23474 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23475 return (int64_t)ret_conv;
23478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23479 if ((this_ptr & 1) != 0) return;
23480 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23481 CHECK_ACCESS(this_ptr_ptr);
23482 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
23483 FREE((void*)this_ptr);
23484 MessageSendEvent_free(this_ptr_conv);
23487 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
23488 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23489 *ret_copy = MessageSendEvent_clone(arg);
23490 int64_t ret_ref = (uintptr_t)ret_copy;
23493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23494 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
23495 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
23499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23500 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
23501 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23502 *ret_copy = MessageSendEvent_clone(orig_conv);
23503 int64_t ret_ref = (uintptr_t)ret_copy;
23507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23508 LDKPublicKey node_id_ref;
23509 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23510 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23511 LDKAcceptChannel msg_conv;
23512 msg_conv.inner = (void*)(msg & (~1));
23513 msg_conv.is_owned = (msg & 1) || (msg == 0);
23514 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23515 msg_conv = AcceptChannel_clone(&msg_conv);
23516 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23517 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
23518 int64_t ret_ref = (uintptr_t)ret_copy;
23522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23523 LDKPublicKey node_id_ref;
23524 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23525 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23526 LDKOpenChannel msg_conv;
23527 msg_conv.inner = (void*)(msg & (~1));
23528 msg_conv.is_owned = (msg & 1) || (msg == 0);
23529 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23530 msg_conv = OpenChannel_clone(&msg_conv);
23531 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23532 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
23533 int64_t ret_ref = (uintptr_t)ret_copy;
23537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23538 LDKPublicKey node_id_ref;
23539 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23540 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23541 LDKFundingCreated msg_conv;
23542 msg_conv.inner = (void*)(msg & (~1));
23543 msg_conv.is_owned = (msg & 1) || (msg == 0);
23544 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23545 msg_conv = FundingCreated_clone(&msg_conv);
23546 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23547 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
23548 int64_t ret_ref = (uintptr_t)ret_copy;
23552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23553 LDKPublicKey node_id_ref;
23554 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23555 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23556 LDKFundingSigned msg_conv;
23557 msg_conv.inner = (void*)(msg & (~1));
23558 msg_conv.is_owned = (msg & 1) || (msg == 0);
23559 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23560 msg_conv = FundingSigned_clone(&msg_conv);
23561 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23562 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
23563 int64_t ret_ref = (uintptr_t)ret_copy;
23567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23568 LDKPublicKey node_id_ref;
23569 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23570 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23571 LDKFundingLocked msg_conv;
23572 msg_conv.inner = (void*)(msg & (~1));
23573 msg_conv.is_owned = (msg & 1) || (msg == 0);
23574 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23575 msg_conv = FundingLocked_clone(&msg_conv);
23576 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23577 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
23578 int64_t ret_ref = (uintptr_t)ret_copy;
23582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23583 LDKPublicKey node_id_ref;
23584 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23585 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23586 LDKAnnouncementSignatures msg_conv;
23587 msg_conv.inner = (void*)(msg & (~1));
23588 msg_conv.is_owned = (msg & 1) || (msg == 0);
23589 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23590 msg_conv = AnnouncementSignatures_clone(&msg_conv);
23591 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23592 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
23593 int64_t ret_ref = (uintptr_t)ret_copy;
23597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
23598 LDKPublicKey node_id_ref;
23599 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23600 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23601 LDKCommitmentUpdate updates_conv;
23602 updates_conv.inner = (void*)(updates & (~1));
23603 updates_conv.is_owned = (updates & 1) || (updates == 0);
23604 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23605 updates_conv = CommitmentUpdate_clone(&updates_conv);
23606 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23607 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
23608 int64_t ret_ref = (uintptr_t)ret_copy;
23612 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) {
23613 LDKPublicKey node_id_ref;
23614 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23615 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23616 LDKRevokeAndACK msg_conv;
23617 msg_conv.inner = (void*)(msg & (~1));
23618 msg_conv.is_owned = (msg & 1) || (msg == 0);
23619 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23620 msg_conv = RevokeAndACK_clone(&msg_conv);
23621 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23622 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
23623 int64_t ret_ref = (uintptr_t)ret_copy;
23627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23628 LDKPublicKey node_id_ref;
23629 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23630 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23631 LDKClosingSigned msg_conv;
23632 msg_conv.inner = (void*)(msg & (~1));
23633 msg_conv.is_owned = (msg & 1) || (msg == 0);
23634 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23635 msg_conv = ClosingSigned_clone(&msg_conv);
23636 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23637 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
23638 int64_t ret_ref = (uintptr_t)ret_copy;
23642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23643 LDKPublicKey node_id_ref;
23644 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23645 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23646 LDKShutdown msg_conv;
23647 msg_conv.inner = (void*)(msg & (~1));
23648 msg_conv.is_owned = (msg & 1) || (msg == 0);
23649 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23650 msg_conv = Shutdown_clone(&msg_conv);
23651 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23652 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
23653 int64_t ret_ref = (uintptr_t)ret_copy;
23657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23658 LDKPublicKey node_id_ref;
23659 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23660 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23661 LDKChannelReestablish msg_conv;
23662 msg_conv.inner = (void*)(msg & (~1));
23663 msg_conv.is_owned = (msg & 1) || (msg == 0);
23664 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23665 msg_conv = ChannelReestablish_clone(&msg_conv);
23666 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23667 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
23668 int64_t ret_ref = (uintptr_t)ret_copy;
23672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
23673 LDKChannelAnnouncement msg_conv;
23674 msg_conv.inner = (void*)(msg & (~1));
23675 msg_conv.is_owned = (msg & 1) || (msg == 0);
23676 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23677 msg_conv = ChannelAnnouncement_clone(&msg_conv);
23678 LDKChannelUpdate update_msg_conv;
23679 update_msg_conv.inner = (void*)(update_msg & (~1));
23680 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
23681 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
23682 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
23683 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23684 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
23685 int64_t ret_ref = (uintptr_t)ret_copy;
23689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
23690 LDKNodeAnnouncement msg_conv;
23691 msg_conv.inner = (void*)(msg & (~1));
23692 msg_conv.is_owned = (msg & 1) || (msg == 0);
23693 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23694 msg_conv = NodeAnnouncement_clone(&msg_conv);
23695 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23696 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
23697 int64_t ret_ref = (uintptr_t)ret_copy;
23701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
23702 LDKChannelUpdate msg_conv;
23703 msg_conv.inner = (void*)(msg & (~1));
23704 msg_conv.is_owned = (msg & 1) || (msg == 0);
23705 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23706 msg_conv = ChannelUpdate_clone(&msg_conv);
23707 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23708 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
23709 int64_t ret_ref = (uintptr_t)ret_copy;
23713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23714 LDKPublicKey node_id_ref;
23715 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23716 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23717 LDKChannelUpdate msg_conv;
23718 msg_conv.inner = (void*)(msg & (~1));
23719 msg_conv.is_owned = (msg & 1) || (msg == 0);
23720 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23721 msg_conv = ChannelUpdate_clone(&msg_conv);
23722 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23723 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
23724 int64_t ret_ref = (uintptr_t)ret_copy;
23728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
23729 LDKPublicKey node_id_ref;
23730 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23731 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23732 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
23733 CHECK_ACCESS(action_ptr);
23734 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
23735 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
23736 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23737 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
23738 int64_t ret_ref = (uintptr_t)ret_copy;
23742 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) {
23743 LDKPublicKey node_id_ref;
23744 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23745 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23746 LDKQueryChannelRange msg_conv;
23747 msg_conv.inner = (void*)(msg & (~1));
23748 msg_conv.is_owned = (msg & 1) || (msg == 0);
23749 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23750 msg_conv = QueryChannelRange_clone(&msg_conv);
23751 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23752 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
23753 int64_t ret_ref = (uintptr_t)ret_copy;
23757 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) {
23758 LDKPublicKey node_id_ref;
23759 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23760 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23761 LDKQueryShortChannelIds msg_conv;
23762 msg_conv.inner = (void*)(msg & (~1));
23763 msg_conv.is_owned = (msg & 1) || (msg == 0);
23764 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23765 msg_conv = QueryShortChannelIds_clone(&msg_conv);
23766 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23767 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
23768 int64_t ret_ref = (uintptr_t)ret_copy;
23772 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) {
23773 LDKPublicKey node_id_ref;
23774 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23775 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23776 LDKReplyChannelRange msg_conv;
23777 msg_conv.inner = (void*)(msg & (~1));
23778 msg_conv.is_owned = (msg & 1) || (msg == 0);
23779 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23780 msg_conv = ReplyChannelRange_clone(&msg_conv);
23781 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23782 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
23783 int64_t ret_ref = (uintptr_t)ret_copy;
23787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23788 LDKPublicKey node_id_ref;
23789 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23790 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23791 LDKGossipTimestampFilter msg_conv;
23792 msg_conv.inner = (void*)(msg & (~1));
23793 msg_conv.is_owned = (msg & 1) || (msg == 0);
23794 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23795 msg_conv = GossipTimestampFilter_clone(&msg_conv);
23796 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23797 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
23798 int64_t ret_ref = (uintptr_t)ret_copy;
23802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23803 if ((this_ptr & 1) != 0) return;
23804 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23805 CHECK_ACCESS(this_ptr_ptr);
23806 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
23807 FREE((void*)this_ptr);
23808 MessageSendEventsProvider_free(this_ptr_conv);
23811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23812 if ((this_ptr & 1) != 0) return;
23813 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23814 CHECK_ACCESS(this_ptr_ptr);
23815 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
23816 FREE((void*)this_ptr);
23817 EventsProvider_free(this_ptr_conv);
23820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23821 if ((this_ptr & 1) != 0) return;
23822 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23823 CHECK_ACCESS(this_ptr_ptr);
23824 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
23825 FREE((void*)this_ptr);
23826 EventHandler_free(this_ptr_conv);
23829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23830 if ((this_ptr & 1) != 0) return;
23831 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23832 CHECK_ACCESS(this_ptr_ptr);
23833 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
23834 FREE((void*)this_ptr);
23835 APIError_free(this_ptr_conv);
23838 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
23839 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23840 *ret_copy = APIError_clone(arg);
23841 int64_t ret_ref = (uintptr_t)ret_copy;
23844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23845 LDKAPIError* arg_conv = (LDKAPIError*)arg;
23846 int64_t ret_val = APIError_clone_ptr(arg_conv);
23850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23851 LDKAPIError* orig_conv = (LDKAPIError*)orig;
23852 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23853 *ret_copy = APIError_clone(orig_conv);
23854 int64_t ret_ref = (uintptr_t)ret_copy;
23858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
23859 LDKStr err_conv = java_to_owned_str(env, err);
23860 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23861 *ret_copy = APIError_apimisuse_error(err_conv);
23862 int64_t ret_ref = (uintptr_t)ret_copy;
23866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
23867 LDKStr err_conv = java_to_owned_str(env, err);
23868 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23869 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
23870 int64_t ret_ref = (uintptr_t)ret_copy;
23874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
23875 LDKStr err_conv = java_to_owned_str(env, err);
23876 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23877 *ret_copy = APIError_route_error(err_conv);
23878 int64_t ret_ref = (uintptr_t)ret_copy;
23882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
23883 LDKStr err_conv = java_to_owned_str(env, err);
23884 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23885 *ret_copy = APIError_channel_unavailable(err_conv);
23886 int64_t ret_ref = (uintptr_t)ret_copy;
23890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
23891 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23892 *ret_copy = APIError_monitor_update_failed();
23893 int64_t ret_ref = (uintptr_t)ret_copy;
23897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
23898 LDKShutdownScript script_conv;
23899 script_conv.inner = (void*)(script & (~1));
23900 script_conv.is_owned = (script & 1) || (script == 0);
23901 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
23902 script_conv = ShutdownScript_clone(&script_conv);
23903 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23904 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
23905 int64_t ret_ref = (uintptr_t)ret_copy;
23909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
23910 LDKu8slice msg_ref;
23911 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23912 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23913 unsigned char sk_arr[32];
23914 CHECK((*env)->GetArrayLength(env, sk) == 32);
23915 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
23916 unsigned char (*sk_ref)[32] = &sk_arr;
23917 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
23918 *ret_conv = sign(msg_ref, sk_ref);
23919 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23920 return (int64_t)ret_conv;
23923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
23924 LDKu8slice msg_ref;
23925 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23926 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23927 LDKStr sig_conv = java_to_owned_str(env, sig);
23928 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23929 *ret_conv = recover_pk(msg_ref, sig_conv);
23930 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23931 return (int64_t)ret_conv;
23934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
23935 LDKu8slice msg_ref;
23936 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23937 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23938 LDKStr sig_conv = java_to_owned_str(env, sig);
23939 LDKPublicKey pk_ref;
23940 CHECK((*env)->GetArrayLength(env, pk) == 33);
23941 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
23942 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
23943 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
23948 LDKu8slice hrp_bytes_ref;
23949 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
23950 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
23951 LDKCVec_u5Z data_without_signature_constr;
23952 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
23953 if (data_without_signature_constr.datalen > 0)
23954 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
23956 data_without_signature_constr.data = NULL;
23957 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
23958 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
23959 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
23961 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
23963 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
23964 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
23965 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23966 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23967 CVec_u8Z_free(ret_var);
23968 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
23972 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23973 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
23974 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
23978 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
23979 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
23983 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
23984 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
23988 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
23989 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
23993 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
23994 jclass ret_conv = LDKLevel_to_java(env, Level_info());
23998 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
23999 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
24003 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
24004 jclass ret_conv = LDKLevel_to_java(env, Level_error());
24008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24009 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
24010 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
24011 jboolean ret_val = Level_eq(a_conv, b_conv);
24015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
24016 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
24017 int64_t ret_val = Level_hash(o_conv);
24021 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
24022 jclass ret_conv = LDKLevel_to_java(env, Level_max());
24026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24027 LDKRecord this_obj_conv;
24028 this_obj_conv.inner = (void*)(this_obj & (~1));
24029 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24031 Record_free(this_obj_conv);
24034 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
24035 LDKRecord this_ptr_conv;
24036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24037 this_ptr_conv.is_owned = false;
24038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24039 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
24043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24044 LDKRecord this_ptr_conv;
24045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24046 this_ptr_conv.is_owned = false;
24047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24048 LDKLevel val_conv = LDKLevel_from_java(env, val);
24049 Record_set_level(&this_ptr_conv, val_conv);
24052 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
24053 LDKRecord 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 LDKStr ret_str = Record_get_args(&this_ptr_conv);
24058 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24064 LDKRecord this_ptr_conv;
24065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24066 this_ptr_conv.is_owned = false;
24067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24068 LDKStr val_conv = java_to_owned_str(env, val);
24069 Record_set_args(&this_ptr_conv, val_conv);
24072 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
24073 LDKRecord this_ptr_conv;
24074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24075 this_ptr_conv.is_owned = false;
24076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24077 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
24078 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24084 LDKRecord this_ptr_conv;
24085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24086 this_ptr_conv.is_owned = false;
24087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24088 LDKStr val_conv = java_to_owned_str(env, val);
24089 Record_set_module_path(&this_ptr_conv, val_conv);
24092 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
24093 LDKRecord this_ptr_conv;
24094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24095 this_ptr_conv.is_owned = false;
24096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24097 LDKStr ret_str = Record_get_file(&this_ptr_conv);
24098 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24104 LDKRecord this_ptr_conv;
24105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24106 this_ptr_conv.is_owned = false;
24107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24108 LDKStr val_conv = java_to_owned_str(env, val);
24109 Record_set_file(&this_ptr_conv, val_conv);
24112 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
24113 LDKRecord this_ptr_conv;
24114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24115 this_ptr_conv.is_owned = false;
24116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24117 int32_t ret_val = Record_get_line(&this_ptr_conv);
24121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24122 LDKRecord this_ptr_conv;
24123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24124 this_ptr_conv.is_owned = false;
24125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24126 Record_set_line(&this_ptr_conv, val);
24129 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
24130 LDKRecord ret_var = Record_clone(arg);
24131 int64_t ret_ref = 0;
24132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24135 ret_ref = (uintptr_t)ret_var.inner;
24136 if (ret_var.is_owned) {
24141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24142 LDKRecord arg_conv;
24143 arg_conv.inner = (void*)(arg & (~1));
24144 arg_conv.is_owned = false;
24145 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24146 int64_t ret_val = Record_clone_ptr(&arg_conv);
24150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24151 LDKRecord orig_conv;
24152 orig_conv.inner = (void*)(orig & (~1));
24153 orig_conv.is_owned = false;
24154 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24155 LDKRecord ret_var = Record_clone(&orig_conv);
24156 int64_t ret_ref = 0;
24157 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24158 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24160 ret_ref = (uintptr_t)ret_var.inner;
24161 if (ret_var.is_owned) {
24167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24168 if ((this_ptr & 1) != 0) return;
24169 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24170 CHECK_ACCESS(this_ptr_ptr);
24171 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
24172 FREE((void*)this_ptr);
24173 Logger_free(this_ptr_conv);
24176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24177 LDKChannelHandshakeConfig this_obj_conv;
24178 this_obj_conv.inner = (void*)(this_obj & (~1));
24179 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24181 ChannelHandshakeConfig_free(this_obj_conv);
24184 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24185 LDKChannelHandshakeConfig 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 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
24193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24194 LDKChannelHandshakeConfig this_ptr_conv;
24195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24196 this_ptr_conv.is_owned = false;
24197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24198 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
24201 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24202 LDKChannelHandshakeConfig 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 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
24210 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) {
24211 LDKChannelHandshakeConfig this_ptr_conv;
24212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24213 this_ptr_conv.is_owned = false;
24214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24215 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
24218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24219 LDKChannelHandshakeConfig 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 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
24227 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) {
24228 LDKChannelHandshakeConfig this_ptr_conv;
24229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24230 this_ptr_conv.is_owned = false;
24231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24232 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
24235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
24236 LDKChannelHandshakeConfig 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 jboolean ret_val = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
24244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24245 LDKChannelHandshakeConfig this_ptr_conv;
24246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24247 this_ptr_conv.is_owned = false;
24248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24249 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
24252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, jboolean negotiate_scid_privacy_arg) {
24253 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, negotiate_scid_privacy_arg);
24254 int64_t ret_ref = 0;
24255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24258 ret_ref = (uintptr_t)ret_var.inner;
24259 if (ret_var.is_owned) {
24265 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
24266 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
24267 int64_t ret_ref = 0;
24268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24271 ret_ref = (uintptr_t)ret_var.inner;
24272 if (ret_var.is_owned) {
24277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24278 LDKChannelHandshakeConfig arg_conv;
24279 arg_conv.inner = (void*)(arg & (~1));
24280 arg_conv.is_owned = false;
24281 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24282 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
24286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24287 LDKChannelHandshakeConfig orig_conv;
24288 orig_conv.inner = (void*)(orig & (~1));
24289 orig_conv.is_owned = false;
24290 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24291 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
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) {
24303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
24304 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
24305 int64_t ret_ref = 0;
24306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24309 ret_ref = (uintptr_t)ret_var.inner;
24310 if (ret_var.is_owned) {
24316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24317 LDKChannelHandshakeLimits this_obj_conv;
24318 this_obj_conv.inner = (void*)(this_obj & (~1));
24319 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24321 ChannelHandshakeLimits_free(this_obj_conv);
24324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24325 LDKChannelHandshakeLimits this_ptr_conv;
24326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24327 this_ptr_conv.is_owned = false;
24328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24329 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
24333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24334 LDKChannelHandshakeLimits this_ptr_conv;
24335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24336 this_ptr_conv.is_owned = false;
24337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24338 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
24341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24342 LDKChannelHandshakeLimits this_ptr_conv;
24343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24344 this_ptr_conv.is_owned = false;
24345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24346 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
24350 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) {
24351 LDKChannelHandshakeLimits this_ptr_conv;
24352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24353 this_ptr_conv.is_owned = false;
24354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24355 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
24358 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) {
24359 LDKChannelHandshakeLimits this_ptr_conv;
24360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24361 this_ptr_conv.is_owned = false;
24362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24363 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
24367 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) {
24368 LDKChannelHandshakeLimits this_ptr_conv;
24369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24370 this_ptr_conv.is_owned = false;
24371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24372 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
24375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24376 LDKChannelHandshakeLimits this_ptr_conv;
24377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24378 this_ptr_conv.is_owned = false;
24379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24380 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
24384 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) {
24385 LDKChannelHandshakeLimits this_ptr_conv;
24386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24387 this_ptr_conv.is_owned = false;
24388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24389 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
24392 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24393 LDKChannelHandshakeLimits this_ptr_conv;
24394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24395 this_ptr_conv.is_owned = false;
24396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24397 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
24401 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) {
24402 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
24409 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24410 LDKChannelHandshakeLimits this_ptr_conv;
24411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24412 this_ptr_conv.is_owned = false;
24413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24414 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
24418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24419 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
24426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
24427 LDKChannelHandshakeLimits this_ptr_conv;
24428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24429 this_ptr_conv.is_owned = false;
24430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24431 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24436 LDKChannelHandshakeLimits this_ptr_conv;
24437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24438 this_ptr_conv.is_owned = false;
24439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24440 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24443 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24444 LDKChannelHandshakeLimits this_ptr_conv;
24445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24446 this_ptr_conv.is_owned = false;
24447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24448 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24452 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) {
24453 LDKChannelHandshakeLimits this_ptr_conv;
24454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24455 this_ptr_conv.is_owned = false;
24456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24457 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24460 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) {
24461 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);
24462 int64_t ret_ref = 0;
24463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24466 ret_ref = (uintptr_t)ret_var.inner;
24467 if (ret_var.is_owned) {
24473 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
24474 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
24475 int64_t ret_ref = 0;
24476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24479 ret_ref = (uintptr_t)ret_var.inner;
24480 if (ret_var.is_owned) {
24485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24486 LDKChannelHandshakeLimits arg_conv;
24487 arg_conv.inner = (void*)(arg & (~1));
24488 arg_conv.is_owned = false;
24489 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24490 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
24494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24495 LDKChannelHandshakeLimits orig_conv;
24496 orig_conv.inner = (void*)(orig & (~1));
24497 orig_conv.is_owned = false;
24498 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24499 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
24500 int64_t ret_ref = 0;
24501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24504 ret_ref = (uintptr_t)ret_var.inner;
24505 if (ret_var.is_owned) {
24511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
24512 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
24513 int64_t ret_ref = 0;
24514 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24515 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24517 ret_ref = (uintptr_t)ret_var.inner;
24518 if (ret_var.is_owned) {
24524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24525 LDKChannelConfig this_obj_conv;
24526 this_obj_conv.inner = (void*)(this_obj & (~1));
24527 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24529 ChannelConfig_free(this_obj_conv);
24532 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24533 LDKChannelConfig this_ptr_conv;
24534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24535 this_ptr_conv.is_owned = false;
24536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24537 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
24541 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) {
24542 LDKChannelConfig this_ptr_conv;
24543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24544 this_ptr_conv.is_owned = false;
24545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24546 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
24549 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24550 LDKChannelConfig this_ptr_conv;
24551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24552 this_ptr_conv.is_owned = false;
24553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24554 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
24558 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) {
24559 LDKChannelConfig this_ptr_conv;
24560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24561 this_ptr_conv.is_owned = false;
24562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24563 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
24566 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24567 LDKChannelConfig this_ptr_conv;
24568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24569 this_ptr_conv.is_owned = false;
24570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24571 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
24575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24576 LDKChannelConfig this_ptr_conv;
24577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24578 this_ptr_conv.is_owned = false;
24579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24580 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
24583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
24584 LDKChannelConfig this_ptr_conv;
24585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24586 this_ptr_conv.is_owned = false;
24587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24588 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
24592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24593 LDKChannelConfig this_ptr_conv;
24594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24595 this_ptr_conv.is_owned = false;
24596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24597 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
24600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24601 LDKChannelConfig this_ptr_conv;
24602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24603 this_ptr_conv.is_owned = false;
24604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24605 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
24609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24610 LDKChannelConfig this_ptr_conv;
24611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24612 this_ptr_conv.is_owned = false;
24613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24614 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
24617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24618 LDKChannelConfig this_ptr_conv;
24619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24620 this_ptr_conv.is_owned = false;
24621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24622 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
24626 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) {
24627 LDKChannelConfig this_ptr_conv;
24628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24629 this_ptr_conv.is_owned = false;
24630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24631 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
24634 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) {
24635 LDKChannelConfig this_ptr_conv;
24636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24637 this_ptr_conv.is_owned = false;
24638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24639 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
24643 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) {
24644 LDKChannelConfig this_ptr_conv;
24645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24646 this_ptr_conv.is_owned = false;
24647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24648 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
24651 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) {
24652 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);
24653 int64_t ret_ref = 0;
24654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24657 ret_ref = (uintptr_t)ret_var.inner;
24658 if (ret_var.is_owned) {
24664 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
24665 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
24666 int64_t ret_ref = 0;
24667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24670 ret_ref = (uintptr_t)ret_var.inner;
24671 if (ret_var.is_owned) {
24676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24677 LDKChannelConfig arg_conv;
24678 arg_conv.inner = (void*)(arg & (~1));
24679 arg_conv.is_owned = false;
24680 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24681 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
24685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24686 LDKChannelConfig orig_conv;
24687 orig_conv.inner = (void*)(orig & (~1));
24688 orig_conv.is_owned = false;
24689 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24690 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24691 int64_t ret_ref = 0;
24692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24695 ret_ref = (uintptr_t)ret_var.inner;
24696 if (ret_var.is_owned) {
24702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
24703 LDKChannelConfig ret_var = ChannelConfig_default();
24704 int64_t ret_ref = 0;
24705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24708 ret_ref = (uintptr_t)ret_var.inner;
24709 if (ret_var.is_owned) {
24715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
24716 LDKChannelConfig obj_conv;
24717 obj_conv.inner = (void*)(obj & (~1));
24718 obj_conv.is_owned = false;
24719 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24720 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24721 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24722 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24723 CVec_u8Z_free(ret_var);
24727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24728 LDKu8slice ser_ref;
24729 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24730 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24731 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24732 *ret_conv = ChannelConfig_read(ser_ref);
24733 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24734 return (int64_t)ret_conv;
24737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24738 LDKUserConfig this_obj_conv;
24739 this_obj_conv.inner = (void*)(this_obj & (~1));
24740 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24742 UserConfig_free(this_obj_conv);
24745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
24746 LDKUserConfig this_ptr_conv;
24747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24748 this_ptr_conv.is_owned = false;
24749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24750 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
24751 int64_t ret_ref = 0;
24752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24755 ret_ref = (uintptr_t)ret_var.inner;
24756 if (ret_var.is_owned) {
24762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24763 LDKUserConfig this_ptr_conv;
24764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24765 this_ptr_conv.is_owned = false;
24766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24767 LDKChannelHandshakeConfig val_conv;
24768 val_conv.inner = (void*)(val & (~1));
24769 val_conv.is_owned = (val & 1) || (val == 0);
24770 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24771 val_conv = ChannelHandshakeConfig_clone(&val_conv);
24772 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
24775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
24776 LDKUserConfig this_ptr_conv;
24777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24778 this_ptr_conv.is_owned = false;
24779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24780 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
24781 int64_t ret_ref = 0;
24782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24785 ret_ref = (uintptr_t)ret_var.inner;
24786 if (ret_var.is_owned) {
24792 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) {
24793 LDKUserConfig 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 LDKChannelHandshakeLimits val_conv;
24798 val_conv.inner = (void*)(val & (~1));
24799 val_conv.is_owned = (val & 1) || (val == 0);
24800 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24801 val_conv = ChannelHandshakeLimits_clone(&val_conv);
24802 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
24805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
24806 LDKUserConfig this_ptr_conv;
24807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24808 this_ptr_conv.is_owned = false;
24809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24810 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
24811 int64_t ret_ref = 0;
24812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24815 ret_ref = (uintptr_t)ret_var.inner;
24816 if (ret_var.is_owned) {
24822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24823 LDKUserConfig 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 LDKChannelConfig val_conv;
24828 val_conv.inner = (void*)(val & (~1));
24829 val_conv.is_owned = (val & 1) || (val == 0);
24830 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24831 val_conv = ChannelConfig_clone(&val_conv);
24832 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
24835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24836 LDKUserConfig this_ptr_conv;
24837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24838 this_ptr_conv.is_owned = false;
24839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24840 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24844 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) {
24845 LDKUserConfig this_ptr_conv;
24846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24847 this_ptr_conv.is_owned = false;
24848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24849 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24853 LDKUserConfig this_ptr_conv;
24854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24855 this_ptr_conv.is_owned = false;
24856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24857 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24862 LDKUserConfig this_ptr_conv;
24863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24864 this_ptr_conv.is_owned = false;
24865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24866 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24870 LDKUserConfig this_ptr_conv;
24871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24872 this_ptr_conv.is_owned = false;
24873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24874 jboolean ret_val = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24879 LDKUserConfig this_ptr_conv;
24880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24881 this_ptr_conv.is_owned = false;
24882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24883 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24886 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) {
24887 LDKChannelHandshakeConfig own_channel_config_arg_conv;
24888 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
24889 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
24890 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
24891 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
24892 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
24893 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
24894 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
24895 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
24896 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
24897 LDKChannelConfig channel_options_arg_conv;
24898 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
24899 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
24900 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
24901 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
24902 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);
24903 int64_t ret_ref = 0;
24904 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24905 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24907 ret_ref = (uintptr_t)ret_var.inner;
24908 if (ret_var.is_owned) {
24914 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24915 LDKUserConfig ret_var = UserConfig_clone(arg);
24916 int64_t ret_ref = 0;
24917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24920 ret_ref = (uintptr_t)ret_var.inner;
24921 if (ret_var.is_owned) {
24926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24927 LDKUserConfig arg_conv;
24928 arg_conv.inner = (void*)(arg & (~1));
24929 arg_conv.is_owned = false;
24930 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24931 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
24935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24936 LDKUserConfig orig_conv;
24937 orig_conv.inner = (void*)(orig & (~1));
24938 orig_conv.is_owned = false;
24939 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24940 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24941 int64_t ret_ref = 0;
24942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24945 ret_ref = (uintptr_t)ret_var.inner;
24946 if (ret_var.is_owned) {
24952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
24953 LDKUserConfig ret_var = UserConfig_default();
24954 int64_t ret_ref = 0;
24955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24958 ret_ref = (uintptr_t)ret_var.inner;
24959 if (ret_var.is_owned) {
24965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24966 LDKBestBlock this_obj_conv;
24967 this_obj_conv.inner = (void*)(this_obj & (~1));
24968 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24970 BestBlock_free(this_obj_conv);
24973 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24974 LDKBestBlock ret_var = BestBlock_clone(arg);
24975 int64_t ret_ref = 0;
24976 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24977 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24979 ret_ref = (uintptr_t)ret_var.inner;
24980 if (ret_var.is_owned) {
24985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24986 LDKBestBlock arg_conv;
24987 arg_conv.inner = (void*)(arg & (~1));
24988 arg_conv.is_owned = false;
24989 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24990 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
24994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24995 LDKBestBlock orig_conv;
24996 orig_conv.inner = (void*)(orig & (~1));
24997 orig_conv.is_owned = false;
24998 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24999 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
25000 int64_t ret_ref = 0;
25001 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25002 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25004 ret_ref = (uintptr_t)ret_var.inner;
25005 if (ret_var.is_owned) {
25011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
25012 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
25013 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
25014 int64_t ret_ref = 0;
25015 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25016 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25018 ret_ref = (uintptr_t)ret_var.inner;
25019 if (ret_var.is_owned) {
25025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
25026 LDKThirtyTwoBytes block_hash_ref;
25027 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
25028 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
25029 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
25030 int64_t ret_ref = 0;
25031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25034 ret_ref = (uintptr_t)ret_var.inner;
25035 if (ret_var.is_owned) {
25041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25042 LDKBestBlock this_arg_conv;
25043 this_arg_conv.inner = (void*)(this_arg & (~1));
25044 this_arg_conv.is_owned = false;
25045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25046 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
25051 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
25052 LDKBestBlock this_arg_conv;
25053 this_arg_conv.inner = (void*)(this_arg & (~1));
25054 this_arg_conv.is_owned = false;
25055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25056 int32_t ret_val = BestBlock_height(&this_arg_conv);
25060 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25061 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
25062 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
25066 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
25067 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
25071 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
25072 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
25076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25077 if ((this_ptr & 1) != 0) return;
25078 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25079 CHECK_ACCESS(this_ptr_ptr);
25080 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
25081 FREE((void*)this_ptr);
25082 Access_free(this_ptr_conv);
25085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25086 if ((this_ptr & 1) != 0) return;
25087 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25088 CHECK_ACCESS(this_ptr_ptr);
25089 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
25090 FREE((void*)this_ptr);
25091 Listen_free(this_ptr_conv);
25094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25095 if ((this_ptr & 1) != 0) return;
25096 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25097 CHECK_ACCESS(this_ptr_ptr);
25098 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
25099 FREE((void*)this_ptr);
25100 Confirm_free(this_ptr_conv);
25103 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25104 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
25105 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
25109 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
25110 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
25114 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
25115 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
25119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25120 if ((this_ptr & 1) != 0) return;
25121 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25122 CHECK_ACCESS(this_ptr_ptr);
25123 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
25124 FREE((void*)this_ptr);
25125 Watch_free(this_ptr_conv);
25128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25129 if ((this_ptr & 1) != 0) return;
25130 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25131 CHECK_ACCESS(this_ptr_ptr);
25132 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
25133 FREE((void*)this_ptr);
25134 Filter_free(this_ptr_conv);
25137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25138 LDKWatchedOutput this_obj_conv;
25139 this_obj_conv.inner = (void*)(this_obj & (~1));
25140 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25142 WatchedOutput_free(this_obj_conv);
25145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25146 LDKWatchedOutput this_ptr_conv;
25147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25148 this_ptr_conv.is_owned = false;
25149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25150 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25151 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
25155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25156 LDKWatchedOutput this_ptr_conv;
25157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25158 this_ptr_conv.is_owned = false;
25159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25160 LDKThirtyTwoBytes val_ref;
25161 CHECK((*env)->GetArrayLength(env, val) == 32);
25162 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25163 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
25166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25167 LDKWatchedOutput this_ptr_conv;
25168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25169 this_ptr_conv.is_owned = false;
25170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25171 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
25172 int64_t ret_ref = 0;
25173 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25174 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25176 ret_ref = (uintptr_t)ret_var.inner;
25177 if (ret_var.is_owned) {
25183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25184 LDKWatchedOutput this_ptr_conv;
25185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25186 this_ptr_conv.is_owned = false;
25187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25188 LDKOutPoint val_conv;
25189 val_conv.inner = (void*)(val & (~1));
25190 val_conv.is_owned = (val & 1) || (val == 0);
25191 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25192 val_conv = OutPoint_clone(&val_conv);
25193 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
25196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25197 LDKWatchedOutput this_ptr_conv;
25198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25199 this_ptr_conv.is_owned = false;
25200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25201 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
25202 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25203 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25208 LDKWatchedOutput this_ptr_conv;
25209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25210 this_ptr_conv.is_owned = false;
25211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25212 LDKCVec_u8Z val_ref;
25213 val_ref.datalen = (*env)->GetArrayLength(env, val);
25214 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
25215 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25216 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
25219 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) {
25220 LDKThirtyTwoBytes block_hash_arg_ref;
25221 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
25222 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
25223 LDKOutPoint outpoint_arg_conv;
25224 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
25225 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
25226 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25227 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25228 LDKCVec_u8Z script_pubkey_arg_ref;
25229 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
25230 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
25231 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
25232 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
25233 int64_t ret_ref = 0;
25234 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25235 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25236 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25237 ret_ref = (uintptr_t)ret_var.inner;
25238 if (ret_var.is_owned) {
25244 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
25245 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
25246 int64_t ret_ref = 0;
25247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25250 ret_ref = (uintptr_t)ret_var.inner;
25251 if (ret_var.is_owned) {
25256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25257 LDKWatchedOutput arg_conv;
25258 arg_conv.inner = (void*)(arg & (~1));
25259 arg_conv.is_owned = false;
25260 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25261 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
25265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25266 LDKWatchedOutput orig_conv;
25267 orig_conv.inner = (void*)(orig & (~1));
25268 orig_conv.is_owned = false;
25269 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25270 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
25271 int64_t ret_ref = 0;
25272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25275 ret_ref = (uintptr_t)ret_var.inner;
25276 if (ret_var.is_owned) {
25282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
25283 LDKWatchedOutput o_conv;
25284 o_conv.inner = (void*)(o & (~1));
25285 o_conv.is_owned = false;
25286 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25287 int64_t ret_val = WatchedOutput_hash(&o_conv);
25291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25292 if ((this_ptr & 1) != 0) return;
25293 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25294 CHECK_ACCESS(this_ptr_ptr);
25295 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
25296 FREE((void*)this_ptr);
25297 BroadcasterInterface_free(this_ptr_conv);
25300 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25301 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
25302 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
25306 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
25307 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
25311 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
25312 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
25316 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
25317 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
25321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25322 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
25323 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
25324 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
25328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25329 if ((this_ptr & 1) != 0) return;
25330 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25331 CHECK_ACCESS(this_ptr_ptr);
25332 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
25333 FREE((void*)this_ptr);
25334 FeeEstimator_free(this_ptr_conv);
25337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25338 LDKMonitorUpdateId this_obj_conv;
25339 this_obj_conv.inner = (void*)(this_obj & (~1));
25340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25342 MonitorUpdateId_free(this_obj_conv);
25345 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
25346 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
25347 int64_t ret_ref = 0;
25348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25351 ret_ref = (uintptr_t)ret_var.inner;
25352 if (ret_var.is_owned) {
25357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25358 LDKMonitorUpdateId arg_conv;
25359 arg_conv.inner = (void*)(arg & (~1));
25360 arg_conv.is_owned = false;
25361 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25362 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25367 LDKMonitorUpdateId orig_conv;
25368 orig_conv.inner = (void*)(orig & (~1));
25369 orig_conv.is_owned = false;
25370 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25371 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
25372 int64_t ret_ref = 0;
25373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25376 ret_ref = (uintptr_t)ret_var.inner;
25377 if (ret_var.is_owned) {
25383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
25384 LDKMonitorUpdateId o_conv;
25385 o_conv.inner = (void*)(o & (~1));
25386 o_conv.is_owned = false;
25387 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25388 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
25392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25393 LDKMonitorUpdateId a_conv;
25394 a_conv.inner = (void*)(a & (~1));
25395 a_conv.is_owned = false;
25396 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25397 LDKMonitorUpdateId b_conv;
25398 b_conv.inner = (void*)(b & (~1));
25399 b_conv.is_owned = false;
25400 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25401 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
25405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25406 if ((this_ptr & 1) != 0) return;
25407 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25408 CHECK_ACCESS(this_ptr_ptr);
25409 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
25410 FREE((void*)this_ptr);
25411 Persist_free(this_ptr_conv);
25414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25415 LDKLockedChannelMonitor this_obj_conv;
25416 this_obj_conv.inner = (void*)(this_obj & (~1));
25417 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25419 LockedChannelMonitor_free(this_obj_conv);
25422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25423 LDKChainMonitor this_obj_conv;
25424 this_obj_conv.inner = (void*)(this_obj & (~1));
25425 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25427 ChainMonitor_free(this_obj_conv);
25430 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) {
25431 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
25432 CHECK_ACCESS(chain_source_ptr);
25433 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
25434 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
25435 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
25436 // Manually implement clone for Java trait instances
25437 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
25438 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25439 LDKFilter_JCalls_cloned(&chain_source_conv.some);
25442 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25443 CHECK_ACCESS(broadcaster_ptr);
25444 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25445 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25446 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25447 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25449 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25450 CHECK_ACCESS(logger_ptr);
25451 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25452 if (logger_conv.free == LDKLogger_JCalls_free) {
25453 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25454 LDKLogger_JCalls_cloned(&logger_conv);
25456 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
25457 CHECK_ACCESS(feeest_ptr);
25458 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
25459 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25460 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25461 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25463 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
25464 CHECK_ACCESS(persister_ptr);
25465 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25466 if (persister_conv.free == LDKPersist_JCalls_free) {
25467 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25468 LDKPersist_JCalls_cloned(&persister_conv);
25470 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25471 int64_t ret_ref = 0;
25472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25475 ret_ref = (uintptr_t)ret_var.inner;
25476 if (ret_var.is_owned) {
25482 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) {
25483 LDKChainMonitor this_arg_conv;
25484 this_arg_conv.inner = (void*)(this_arg & (~1));
25485 this_arg_conv.is_owned = false;
25486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25487 LDKCVec_ChannelDetailsZ ignored_channels_constr;
25488 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
25489 if (ignored_channels_constr.datalen > 0)
25490 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25492 ignored_channels_constr.data = NULL;
25493 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
25494 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25495 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25496 LDKChannelDetails ignored_channels_conv_16_conv;
25497 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
25498 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
25499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25500 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25501 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25503 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
25504 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25505 int64_tArray ret_arr = NULL;
25506 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25507 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25508 for (size_t j = 0; j < ret_var.datalen; j++) {
25509 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25510 *ret_conv_9_copy = ret_var.data[j];
25511 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
25512 ret_arr_ptr[j] = ret_conv_9_ref;
25514 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25515 FREE(ret_var.data);
25519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
25520 LDKChainMonitor this_arg_conv;
25521 this_arg_conv.inner = (void*)(this_arg & (~1));
25522 this_arg_conv.is_owned = false;
25523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25524 LDKOutPoint funding_txo_conv;
25525 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25526 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25527 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25528 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25529 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25530 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25531 return (int64_t)ret_conv;
25534 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
25535 LDKChainMonitor this_arg_conv;
25536 this_arg_conv.inner = (void*)(this_arg & (~1));
25537 this_arg_conv.is_owned = false;
25538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25539 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25540 int64_tArray ret_arr = NULL;
25541 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25542 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25543 for (size_t k = 0; k < ret_var.datalen; k++) {
25544 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25545 int64_t ret_conv_10_ref = 0;
25546 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25547 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25549 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
25550 if (ret_conv_10_var.is_owned) {
25551 ret_conv_10_ref |= 1;
25553 ret_arr_ptr[k] = ret_conv_10_ref;
25555 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25556 FREE(ret_var.data);
25560 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) {
25561 LDKChainMonitor this_arg_conv;
25562 this_arg_conv.inner = (void*)(this_arg & (~1));
25563 this_arg_conv.is_owned = false;
25564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25565 LDKOutPoint funding_txo_conv;
25566 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25567 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25568 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25569 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25570 LDKMonitorUpdateId completed_update_id_conv;
25571 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
25572 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
25573 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25574 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25575 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25576 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25577 return (int64_t)ret_conv;
25580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
25581 LDKChainMonitor this_arg_conv;
25582 this_arg_conv.inner = (void*)(this_arg & (~1));
25583 this_arg_conv.is_owned = false;
25584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25585 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25586 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
25587 return (int64_t)ret_ret;
25590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
25591 LDKChainMonitor this_arg_conv;
25592 this_arg_conv.inner = (void*)(this_arg & (~1));
25593 this_arg_conv.is_owned = false;
25594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25595 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25596 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
25597 return (int64_t)ret_ret;
25600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
25601 LDKChainMonitor this_arg_conv;
25602 this_arg_conv.inner = (void*)(this_arg & (~1));
25603 this_arg_conv.is_owned = false;
25604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25605 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
25606 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
25607 return (int64_t)ret_ret;
25610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25611 LDKChainMonitor this_arg_conv;
25612 this_arg_conv.inner = (void*)(this_arg & (~1));
25613 this_arg_conv.is_owned = false;
25614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25615 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25616 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
25617 return (int64_t)ret_ret;
25620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25621 LDKChannelMonitorUpdate this_obj_conv;
25622 this_obj_conv.inner = (void*)(this_obj & (~1));
25623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25625 ChannelMonitorUpdate_free(this_obj_conv);
25628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
25629 LDKChannelMonitorUpdate this_ptr_conv;
25630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25631 this_ptr_conv.is_owned = false;
25632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25633 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
25637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25638 LDKChannelMonitorUpdate this_ptr_conv;
25639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25640 this_ptr_conv.is_owned = false;
25641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25642 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
25645 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
25646 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
25647 int64_t ret_ref = 0;
25648 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25649 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25650 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25651 ret_ref = (uintptr_t)ret_var.inner;
25652 if (ret_var.is_owned) {
25657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25658 LDKChannelMonitorUpdate arg_conv;
25659 arg_conv.inner = (void*)(arg & (~1));
25660 arg_conv.is_owned = false;
25661 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25662 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25667 LDKChannelMonitorUpdate orig_conv;
25668 orig_conv.inner = (void*)(orig & (~1));
25669 orig_conv.is_owned = false;
25670 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25671 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25672 int64_t ret_ref = 0;
25673 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25674 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25675 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25676 ret_ref = (uintptr_t)ret_var.inner;
25677 if (ret_var.is_owned) {
25683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25684 LDKChannelMonitorUpdate obj_conv;
25685 obj_conv.inner = (void*)(obj & (~1));
25686 obj_conv.is_owned = false;
25687 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25688 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25689 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25690 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25691 CVec_u8Z_free(ret_var);
25695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25696 LDKu8slice ser_ref;
25697 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25698 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25699 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25700 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25701 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25702 return (int64_t)ret_conv;
25705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25706 if ((this_ptr & 1) != 0) return;
25707 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25708 CHECK_ACCESS(this_ptr_ptr);
25709 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25710 FREE((void*)this_ptr);
25711 MonitorEvent_free(this_ptr_conv);
25714 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25715 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25716 *ret_copy = MonitorEvent_clone(arg);
25717 int64_t ret_ref = (uintptr_t)ret_copy;
25720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25721 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
25722 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
25726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25727 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
25728 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25729 *ret_copy = MonitorEvent_clone(orig_conv);
25730 int64_t ret_ref = (uintptr_t)ret_copy;
25734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
25735 LDKHTLCUpdate a_conv;
25736 a_conv.inner = (void*)(a & (~1));
25737 a_conv.is_owned = (a & 1) || (a == 0);
25738 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25739 a_conv = HTLCUpdate_clone(&a_conv);
25740 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25741 *ret_copy = MonitorEvent_htlcevent(a_conv);
25742 int64_t ret_ref = (uintptr_t)ret_copy;
25746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
25747 LDKOutPoint a_conv;
25748 a_conv.inner = (void*)(a & (~1));
25749 a_conv.is_owned = (a & 1) || (a == 0);
25750 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25751 a_conv = OutPoint_clone(&a_conv);
25752 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25753 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25754 int64_t ret_ref = (uintptr_t)ret_copy;
25758 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) {
25759 LDKOutPoint funding_txo_conv;
25760 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25761 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25762 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25763 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25764 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25765 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
25766 int64_t ret_ref = (uintptr_t)ret_copy;
25770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
25771 LDKOutPoint a_conv;
25772 a_conv.inner = (void*)(a & (~1));
25773 a_conv.is_owned = (a & 1) || (a == 0);
25774 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25775 a_conv = OutPoint_clone(&a_conv);
25776 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25777 *ret_copy = MonitorEvent_update_failed(a_conv);
25778 int64_t ret_ref = (uintptr_t)ret_copy;
25782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
25783 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
25784 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25785 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25786 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25787 CVec_u8Z_free(ret_var);
25791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25792 LDKu8slice ser_ref;
25793 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25794 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25795 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25796 *ret_conv = MonitorEvent_read(ser_ref);
25797 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25798 return (int64_t)ret_conv;
25801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25802 LDKHTLCUpdate this_obj_conv;
25803 this_obj_conv.inner = (void*)(this_obj & (~1));
25804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25806 HTLCUpdate_free(this_obj_conv);
25809 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25810 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25811 int64_t ret_ref = 0;
25812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25815 ret_ref = (uintptr_t)ret_var.inner;
25816 if (ret_var.is_owned) {
25821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25822 LDKHTLCUpdate arg_conv;
25823 arg_conv.inner = (void*)(arg & (~1));
25824 arg_conv.is_owned = false;
25825 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25826 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
25830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25831 LDKHTLCUpdate orig_conv;
25832 orig_conv.inner = (void*)(orig & (~1));
25833 orig_conv.is_owned = false;
25834 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25835 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25836 int64_t ret_ref = 0;
25837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25840 ret_ref = (uintptr_t)ret_var.inner;
25841 if (ret_var.is_owned) {
25847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25848 LDKHTLCUpdate obj_conv;
25849 obj_conv.inner = (void*)(obj & (~1));
25850 obj_conv.is_owned = false;
25851 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25852 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25853 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25854 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25855 CVec_u8Z_free(ret_var);
25859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25860 LDKu8slice ser_ref;
25861 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25862 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25863 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25864 *ret_conv = HTLCUpdate_read(ser_ref);
25865 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25866 return (int64_t)ret_conv;
25869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25870 if ((this_ptr & 1) != 0) return;
25871 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25872 CHECK_ACCESS(this_ptr_ptr);
25873 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25874 FREE((void*)this_ptr);
25875 Balance_free(this_ptr_conv);
25878 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25879 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25880 *ret_copy = Balance_clone(arg);
25881 int64_t ret_ref = (uintptr_t)ret_copy;
25884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25885 LDKBalance* arg_conv = (LDKBalance*)arg;
25886 int64_t ret_val = Balance_clone_ptr(arg_conv);
25890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25891 LDKBalance* orig_conv = (LDKBalance*)orig;
25892 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25893 *ret_copy = Balance_clone(orig_conv);
25894 int64_t ret_ref = (uintptr_t)ret_copy;
25898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
25899 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25900 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25901 int64_t ret_ref = (uintptr_t)ret_copy;
25905 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) {
25906 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25907 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25908 int64_t ret_ref = (uintptr_t)ret_copy;
25912 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) {
25913 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25914 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25915 int64_t ret_ref = (uintptr_t)ret_copy;
25919 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) {
25920 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25921 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
25922 int64_t ret_ref = (uintptr_t)ret_copy;
25926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25927 LDKBalance* a_conv = (LDKBalance*)a;
25928 LDKBalance* b_conv = (LDKBalance*)b;
25929 jboolean ret_val = Balance_eq(a_conv, b_conv);
25933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25934 LDKChannelMonitor this_obj_conv;
25935 this_obj_conv.inner = (void*)(this_obj & (~1));
25936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25938 ChannelMonitor_free(this_obj_conv);
25941 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25942 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25943 int64_t ret_ref = 0;
25944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25947 ret_ref = (uintptr_t)ret_var.inner;
25948 if (ret_var.is_owned) {
25953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25954 LDKChannelMonitor arg_conv;
25955 arg_conv.inner = (void*)(arg & (~1));
25956 arg_conv.is_owned = false;
25957 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25958 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
25962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25963 LDKChannelMonitor orig_conv;
25964 orig_conv.inner = (void*)(orig & (~1));
25965 orig_conv.is_owned = false;
25966 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25967 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25968 int64_t ret_ref = 0;
25969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25972 ret_ref = (uintptr_t)ret_var.inner;
25973 if (ret_var.is_owned) {
25979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
25980 LDKChannelMonitor obj_conv;
25981 obj_conv.inner = (void*)(obj & (~1));
25982 obj_conv.is_owned = false;
25983 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25984 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25985 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25986 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25987 CVec_u8Z_free(ret_var);
25991 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) {
25992 LDKChannelMonitor this_arg_conv;
25993 this_arg_conv.inner = (void*)(this_arg & (~1));
25994 this_arg_conv.is_owned = false;
25995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25996 LDKChannelMonitorUpdate updates_conv;
25997 updates_conv.inner = (void*)(updates & (~1));
25998 updates_conv.is_owned = false;
25999 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
26000 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26001 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
26002 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
26003 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26004 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
26005 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
26006 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26007 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
26008 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26009 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
26010 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
26011 return (int64_t)ret_conv;
26014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26015 LDKChannelMonitor this_arg_conv;
26016 this_arg_conv.inner = (void*)(this_arg & (~1));
26017 this_arg_conv.is_owned = false;
26018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26019 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
26023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
26024 LDKChannelMonitor this_arg_conv;
26025 this_arg_conv.inner = (void*)(this_arg & (~1));
26026 this_arg_conv.is_owned = false;
26027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26028 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
26029 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
26030 return ((int64_t)ret_conv);
26033 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26034 LDKChannelMonitor this_arg_conv;
26035 this_arg_conv.inner = (void*)(this_arg & (~1));
26036 this_arg_conv.is_owned = false;
26037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26038 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
26039 int64_tArray ret_arr = NULL;
26040 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26041 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26042 for (size_t o = 0; o < ret_var.datalen; o++) {
26043 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
26044 *ret_conv_40_conv = ret_var.data[o];
26045 ret_arr_ptr[o] = ((int64_t)ret_conv_40_conv);
26047 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26048 FREE(ret_var.data);
26052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
26053 LDKChannelMonitor this_arg_conv;
26054 this_arg_conv.inner = (void*)(this_arg & (~1));
26055 this_arg_conv.is_owned = false;
26056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26057 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
26058 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
26059 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
26060 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
26063 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26064 LDKChannelMonitor this_arg_conv;
26065 this_arg_conv.inner = (void*)(this_arg & (~1));
26066 this_arg_conv.is_owned = false;
26067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26068 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
26069 int64_tArray ret_arr = NULL;
26070 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26071 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26072 for (size_t o = 0; o < ret_var.datalen; o++) {
26073 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26074 *ret_conv_14_copy = ret_var.data[o];
26075 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
26076 ret_arr_ptr[o] = ret_conv_14_ref;
26078 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26079 FREE(ret_var.data);
26083 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26084 LDKChannelMonitor this_arg_conv;
26085 this_arg_conv.inner = (void*)(this_arg & (~1));
26086 this_arg_conv.is_owned = false;
26087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26088 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
26089 int64_tArray ret_arr = NULL;
26090 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26091 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26092 for (size_t h = 0; h < ret_var.datalen; h++) {
26093 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26094 *ret_conv_7_copy = ret_var.data[h];
26095 int64_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
26096 ret_arr_ptr[h] = ret_conv_7_ref;
26098 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26099 FREE(ret_var.data);
26103 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) {
26104 LDKChannelMonitor this_arg_conv;
26105 this_arg_conv.inner = (void*)(this_arg & (~1));
26106 this_arg_conv.is_owned = false;
26107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26108 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26109 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
26110 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26111 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
26112 jobjectArray ret_arr = NULL;
26113 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26115 for (size_t i = 0; i < ret_var.datalen; i++) {
26116 LDKTransaction ret_conv_8_var = ret_var.data[i];
26117 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
26118 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
26119 Transaction_free(ret_conv_8_var);
26120 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26123 FREE(ret_var.data);
26127 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) {
26128 LDKChannelMonitor this_arg_conv;
26129 this_arg_conv.inner = (void*)(this_arg & (~1));
26130 this_arg_conv.is_owned = false;
26131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26132 unsigned char header_arr[80];
26133 CHECK((*env)->GetArrayLength(env, header) == 80);
26134 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26135 unsigned char (*header_ref)[80] = &header_arr;
26136 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26137 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26138 if (txdata_constr.datalen > 0)
26139 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26141 txdata_constr.data = NULL;
26142 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26143 for (size_t c = 0; c < txdata_constr.datalen; c++) {
26144 int64_t txdata_conv_28 = txdata_vals[c];
26145 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
26146 CHECK_ACCESS(txdata_conv_28_ptr);
26147 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26148 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
26149 txdata_constr.data[c] = txdata_conv_28_conv;
26151 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26152 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26153 CHECK_ACCESS(broadcaster_ptr);
26154 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26155 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26156 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26157 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26159 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26160 CHECK_ACCESS(fee_estimator_ptr);
26161 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26162 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26163 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26164 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26166 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26167 CHECK_ACCESS(logger_ptr);
26168 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26169 if (logger_conv.free == LDKLogger_JCalls_free) {
26170 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26171 LDKLogger_JCalls_cloned(&logger_conv);
26173 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);
26174 int64_tArray ret_arr = NULL;
26175 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26176 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26177 for (size_t n = 0; n < ret_var.datalen; n++) {
26178 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26179 *ret_conv_39_conv = ret_var.data[n];
26180 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26182 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26183 FREE(ret_var.data);
26187 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) {
26188 LDKChannelMonitor this_arg_conv;
26189 this_arg_conv.inner = (void*)(this_arg & (~1));
26190 this_arg_conv.is_owned = false;
26191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26192 unsigned char header_arr[80];
26193 CHECK((*env)->GetArrayLength(env, header) == 80);
26194 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26195 unsigned char (*header_ref)[80] = &header_arr;
26196 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26197 CHECK_ACCESS(broadcaster_ptr);
26198 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26199 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26200 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26201 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26203 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26204 CHECK_ACCESS(fee_estimator_ptr);
26205 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26206 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26207 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26208 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26210 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26211 CHECK_ACCESS(logger_ptr);
26212 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26213 if (logger_conv.free == LDKLogger_JCalls_free) {
26214 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26215 LDKLogger_JCalls_cloned(&logger_conv);
26217 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26220 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) {
26221 LDKChannelMonitor this_arg_conv;
26222 this_arg_conv.inner = (void*)(this_arg & (~1));
26223 this_arg_conv.is_owned = false;
26224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26225 unsigned char header_arr[80];
26226 CHECK((*env)->GetArrayLength(env, header) == 80);
26227 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26228 unsigned char (*header_ref)[80] = &header_arr;
26229 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26230 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26231 if (txdata_constr.datalen > 0)
26232 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26234 txdata_constr.data = NULL;
26235 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26236 for (size_t c = 0; c < txdata_constr.datalen; c++) {
26237 int64_t txdata_conv_28 = txdata_vals[c];
26238 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
26239 CHECK_ACCESS(txdata_conv_28_ptr);
26240 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26241 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
26242 txdata_constr.data[c] = txdata_conv_28_conv;
26244 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26245 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26246 CHECK_ACCESS(broadcaster_ptr);
26247 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26248 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26249 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26250 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26252 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26253 CHECK_ACCESS(fee_estimator_ptr);
26254 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26255 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26256 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26257 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26259 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26260 CHECK_ACCESS(logger_ptr);
26261 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26262 if (logger_conv.free == LDKLogger_JCalls_free) {
26263 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26264 LDKLogger_JCalls_cloned(&logger_conv);
26266 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);
26267 int64_tArray ret_arr = NULL;
26268 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26269 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26270 for (size_t n = 0; n < ret_var.datalen; n++) {
26271 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26272 *ret_conv_39_conv = ret_var.data[n];
26273 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26275 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26276 FREE(ret_var.data);
26280 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) {
26281 LDKChannelMonitor this_arg_conv;
26282 this_arg_conv.inner = (void*)(this_arg & (~1));
26283 this_arg_conv.is_owned = false;
26284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26285 unsigned char txid_arr[32];
26286 CHECK((*env)->GetArrayLength(env, txid) == 32);
26287 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
26288 unsigned char (*txid_ref)[32] = &txid_arr;
26289 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26290 CHECK_ACCESS(broadcaster_ptr);
26291 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26292 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26293 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26294 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26296 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26297 CHECK_ACCESS(fee_estimator_ptr);
26298 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26299 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26300 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26301 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26303 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26304 CHECK_ACCESS(logger_ptr);
26305 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26306 if (logger_conv.free == LDKLogger_JCalls_free) {
26307 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26308 LDKLogger_JCalls_cloned(&logger_conv);
26310 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
26313 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) {
26314 LDKChannelMonitor this_arg_conv;
26315 this_arg_conv.inner = (void*)(this_arg & (~1));
26316 this_arg_conv.is_owned = false;
26317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26318 unsigned char header_arr[80];
26319 CHECK((*env)->GetArrayLength(env, header) == 80);
26320 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26321 unsigned char (*header_ref)[80] = &header_arr;
26322 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26323 CHECK_ACCESS(broadcaster_ptr);
26324 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26325 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26326 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26327 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26329 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26330 CHECK_ACCESS(fee_estimator_ptr);
26331 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26332 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26333 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26334 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26336 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26337 CHECK_ACCESS(logger_ptr);
26338 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26339 if (logger_conv.free == LDKLogger_JCalls_free) {
26340 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26341 LDKLogger_JCalls_cloned(&logger_conv);
26343 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26344 int64_tArray ret_arr = NULL;
26345 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26346 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26347 for (size_t n = 0; n < ret_var.datalen; n++) {
26348 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26349 *ret_conv_39_conv = ret_var.data[n];
26350 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26352 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26353 FREE(ret_var.data);
26357 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
26358 LDKChannelMonitor this_arg_conv;
26359 this_arg_conv.inner = (void*)(this_arg & (~1));
26360 this_arg_conv.is_owned = false;
26361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26362 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
26363 jobjectArray ret_arr = NULL;
26364 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26366 for (size_t i = 0; i < ret_var.datalen; i++) {
26367 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
26368 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
26369 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26372 FREE(ret_var.data);
26376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
26377 LDKChannelMonitor this_arg_conv;
26378 this_arg_conv.inner = (void*)(this_arg & (~1));
26379 this_arg_conv.is_owned = false;
26380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26381 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
26382 int64_t ret_ref = 0;
26383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26386 ret_ref = (uintptr_t)ret_var.inner;
26387 if (ret_var.is_owned) {
26393 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
26394 LDKChannelMonitor this_arg_conv;
26395 this_arg_conv.inner = (void*)(this_arg & (~1));
26396 this_arg_conv.is_owned = false;
26397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26398 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26399 int64_tArray ret_arr = NULL;
26400 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26401 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26402 for (size_t j = 0; j < ret_var.datalen; j++) {
26403 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26404 *ret_conv_9_copy = ret_var.data[j];
26405 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
26406 ret_arr_ptr[j] = ret_conv_9_ref;
26408 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26409 FREE(ret_var.data);
26413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
26414 LDKu8slice ser_ref;
26415 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26416 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26417 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
26418 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
26419 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
26420 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26421 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
26422 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26423 return (int64_t)ret_conv;
26426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26427 LDKOutPoint this_obj_conv;
26428 this_obj_conv.inner = (void*)(this_obj & (~1));
26429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26431 OutPoint_free(this_obj_conv);
26434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26435 LDKOutPoint this_ptr_conv;
26436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26437 this_ptr_conv.is_owned = false;
26438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26439 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26440 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
26444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26445 LDKOutPoint this_ptr_conv;
26446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26447 this_ptr_conv.is_owned = false;
26448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26449 LDKThirtyTwoBytes val_ref;
26450 CHECK((*env)->GetArrayLength(env, val) == 32);
26451 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26452 OutPoint_set_txid(&this_ptr_conv, val_ref);
26455 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
26456 LDKOutPoint this_ptr_conv;
26457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26458 this_ptr_conv.is_owned = false;
26459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26460 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
26464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26465 LDKOutPoint this_ptr_conv;
26466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26467 this_ptr_conv.is_owned = false;
26468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26469 OutPoint_set_index(&this_ptr_conv, val);
26472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
26473 LDKThirtyTwoBytes txid_arg_ref;
26474 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26475 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26476 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26477 int64_t ret_ref = 0;
26478 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26479 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26481 ret_ref = (uintptr_t)ret_var.inner;
26482 if (ret_var.is_owned) {
26488 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26489 LDKOutPoint ret_var = OutPoint_clone(arg);
26490 int64_t ret_ref = 0;
26491 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26492 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26493 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26494 ret_ref = (uintptr_t)ret_var.inner;
26495 if (ret_var.is_owned) {
26500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26501 LDKOutPoint arg_conv;
26502 arg_conv.inner = (void*)(arg & (~1));
26503 arg_conv.is_owned = false;
26504 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26505 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
26509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26510 LDKOutPoint orig_conv;
26511 orig_conv.inner = (void*)(orig & (~1));
26512 orig_conv.is_owned = false;
26513 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26514 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26515 int64_t ret_ref = 0;
26516 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26517 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26518 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26519 ret_ref = (uintptr_t)ret_var.inner;
26520 if (ret_var.is_owned) {
26526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26527 LDKOutPoint a_conv;
26528 a_conv.inner = (void*)(a & (~1));
26529 a_conv.is_owned = false;
26530 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26531 LDKOutPoint b_conv;
26532 b_conv.inner = (void*)(b & (~1));
26533 b_conv.is_owned = false;
26534 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26535 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
26539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26540 LDKOutPoint o_conv;
26541 o_conv.inner = (void*)(o & (~1));
26542 o_conv.is_owned = false;
26543 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26544 int64_t ret_val = OutPoint_hash(&o_conv);
26548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26549 LDKOutPoint this_arg_conv;
26550 this_arg_conv.inner = (void*)(this_arg & (~1));
26551 this_arg_conv.is_owned = false;
26552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26553 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26554 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
26558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
26559 LDKOutPoint obj_conv;
26560 obj_conv.inner = (void*)(obj & (~1));
26561 obj_conv.is_owned = false;
26562 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26563 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26564 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26565 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26566 CVec_u8Z_free(ret_var);
26570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26571 LDKu8slice ser_ref;
26572 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26573 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26574 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26575 *ret_conv = OutPoint_read(ser_ref);
26576 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26577 return (int64_t)ret_conv;
26580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26581 LDKDelayedPaymentOutputDescriptor this_obj_conv;
26582 this_obj_conv.inner = (void*)(this_obj & (~1));
26583 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26585 DelayedPaymentOutputDescriptor_free(this_obj_conv);
26588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26589 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26591 this_ptr_conv.is_owned = false;
26592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26593 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26594 int64_t ret_ref = 0;
26595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26598 ret_ref = (uintptr_t)ret_var.inner;
26599 if (ret_var.is_owned) {
26605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26606 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26608 this_ptr_conv.is_owned = false;
26609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26610 LDKOutPoint val_conv;
26611 val_conv.inner = (void*)(val & (~1));
26612 val_conv.is_owned = (val & 1) || (val == 0);
26613 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26614 val_conv = OutPoint_clone(&val_conv);
26615 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26619 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26621 this_ptr_conv.is_owned = false;
26622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26623 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26624 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
26628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26629 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26631 this_ptr_conv.is_owned = false;
26632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26633 LDKPublicKey val_ref;
26634 CHECK((*env)->GetArrayLength(env, val) == 33);
26635 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26636 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26639 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26640 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26642 this_ptr_conv.is_owned = false;
26643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26644 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26649 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26651 this_ptr_conv.is_owned = false;
26652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26653 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26657 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26659 this_ptr_conv.is_owned = false;
26660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26661 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26662 CHECK_ACCESS(val_ptr);
26663 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26664 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26665 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26669 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26671 this_ptr_conv.is_owned = false;
26672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26673 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26674 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
26678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26679 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26681 this_ptr_conv.is_owned = false;
26682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26683 LDKPublicKey val_ref;
26684 CHECK((*env)->GetArrayLength(env, val) == 33);
26685 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26686 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26690 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26692 this_ptr_conv.is_owned = false;
26693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26694 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26695 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26700 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26702 this_ptr_conv.is_owned = false;
26703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26704 LDKThirtyTwoBytes val_ref;
26705 CHECK((*env)->GetArrayLength(env, val) == 32);
26706 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26707 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26711 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26713 this_ptr_conv.is_owned = false;
26714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26715 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26720 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26722 this_ptr_conv.is_owned = false;
26723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26724 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26727 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) {
26728 LDKOutPoint outpoint_arg_conv;
26729 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26730 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26731 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26732 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26733 LDKPublicKey per_commitment_point_arg_ref;
26734 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
26735 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
26736 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26737 CHECK_ACCESS(output_arg_ptr);
26738 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26739 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26740 LDKPublicKey revocation_pubkey_arg_ref;
26741 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
26742 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
26743 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26744 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26745 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26746 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);
26747 int64_t ret_ref = 0;
26748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26751 ret_ref = (uintptr_t)ret_var.inner;
26752 if (ret_var.is_owned) {
26758 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26759 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26760 int64_t ret_ref = 0;
26761 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26762 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26764 ret_ref = (uintptr_t)ret_var.inner;
26765 if (ret_var.is_owned) {
26770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26771 LDKDelayedPaymentOutputDescriptor arg_conv;
26772 arg_conv.inner = (void*)(arg & (~1));
26773 arg_conv.is_owned = false;
26774 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26775 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26780 LDKDelayedPaymentOutputDescriptor orig_conv;
26781 orig_conv.inner = (void*)(orig & (~1));
26782 orig_conv.is_owned = false;
26783 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26784 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26785 int64_t ret_ref = 0;
26786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26789 ret_ref = (uintptr_t)ret_var.inner;
26790 if (ret_var.is_owned) {
26796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26797 LDKDelayedPaymentOutputDescriptor obj_conv;
26798 obj_conv.inner = (void*)(obj & (~1));
26799 obj_conv.is_owned = false;
26800 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26801 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26802 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26803 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26804 CVec_u8Z_free(ret_var);
26808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26809 LDKu8slice ser_ref;
26810 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26811 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26812 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26813 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26814 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26815 return (int64_t)ret_conv;
26818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26819 LDKStaticPaymentOutputDescriptor this_obj_conv;
26820 this_obj_conv.inner = (void*)(this_obj & (~1));
26821 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26823 StaticPaymentOutputDescriptor_free(this_obj_conv);
26826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26827 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26829 this_ptr_conv.is_owned = false;
26830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26831 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26832 int64_t ret_ref = 0;
26833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26836 ret_ref = (uintptr_t)ret_var.inner;
26837 if (ret_var.is_owned) {
26843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26844 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26846 this_ptr_conv.is_owned = false;
26847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26848 LDKOutPoint val_conv;
26849 val_conv.inner = (void*)(val & (~1));
26850 val_conv.is_owned = (val & 1) || (val == 0);
26851 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26852 val_conv = OutPoint_clone(&val_conv);
26853 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26857 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26859 this_ptr_conv.is_owned = false;
26860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26861 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26862 CHECK_ACCESS(val_ptr);
26863 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26864 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26865 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26869 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26871 this_ptr_conv.is_owned = false;
26872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26873 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26879 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26881 this_ptr_conv.is_owned = false;
26882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26883 LDKThirtyTwoBytes val_ref;
26884 CHECK((*env)->GetArrayLength(env, val) == 32);
26885 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26886 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26890 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26892 this_ptr_conv.is_owned = false;
26893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26894 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26899 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26901 this_ptr_conv.is_owned = false;
26902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26903 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26906 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) {
26907 LDKOutPoint outpoint_arg_conv;
26908 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26909 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26910 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26911 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26912 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26913 CHECK_ACCESS(output_arg_ptr);
26914 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26915 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26916 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26917 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26918 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26919 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26920 int64_t ret_ref = 0;
26921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26924 ret_ref = (uintptr_t)ret_var.inner;
26925 if (ret_var.is_owned) {
26931 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26932 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26933 int64_t ret_ref = 0;
26934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26937 ret_ref = (uintptr_t)ret_var.inner;
26938 if (ret_var.is_owned) {
26943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26944 LDKStaticPaymentOutputDescriptor arg_conv;
26945 arg_conv.inner = (void*)(arg & (~1));
26946 arg_conv.is_owned = false;
26947 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26948 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26953 LDKStaticPaymentOutputDescriptor orig_conv;
26954 orig_conv.inner = (void*)(orig & (~1));
26955 orig_conv.is_owned = false;
26956 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26957 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26958 int64_t ret_ref = 0;
26959 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26960 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26962 ret_ref = (uintptr_t)ret_var.inner;
26963 if (ret_var.is_owned) {
26969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26970 LDKStaticPaymentOutputDescriptor obj_conv;
26971 obj_conv.inner = (void*)(obj & (~1));
26972 obj_conv.is_owned = false;
26973 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26974 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26975 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26976 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26977 CVec_u8Z_free(ret_var);
26981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26982 LDKu8slice ser_ref;
26983 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26984 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26985 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26986 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26987 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26988 return (int64_t)ret_conv;
26991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26992 if ((this_ptr & 1) != 0) return;
26993 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26994 CHECK_ACCESS(this_ptr_ptr);
26995 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26996 FREE((void*)this_ptr);
26997 SpendableOutputDescriptor_free(this_ptr_conv);
27000 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
27001 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27002 *ret_copy = SpendableOutputDescriptor_clone(arg);
27003 int64_t ret_ref = (uintptr_t)ret_copy;
27006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27007 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
27008 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
27012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27013 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
27014 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27015 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
27016 int64_t ret_ref = (uintptr_t)ret_copy;
27020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
27021 LDKOutPoint outpoint_conv;
27022 outpoint_conv.inner = (void*)(outpoint & (~1));
27023 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
27024 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
27025 outpoint_conv = OutPoint_clone(&outpoint_conv);
27026 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
27027 CHECK_ACCESS(output_ptr);
27028 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
27029 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
27030 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27031 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
27032 int64_t ret_ref = (uintptr_t)ret_copy;
27036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27037 LDKDelayedPaymentOutputDescriptor a_conv;
27038 a_conv.inner = (void*)(a & (~1));
27039 a_conv.is_owned = (a & 1) || (a == 0);
27040 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27041 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
27042 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27043 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
27044 int64_t ret_ref = (uintptr_t)ret_copy;
27048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27049 LDKStaticPaymentOutputDescriptor a_conv;
27050 a_conv.inner = (void*)(a & (~1));
27051 a_conv.is_owned = (a & 1) || (a == 0);
27052 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27053 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
27054 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27055 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
27056 int64_t ret_ref = (uintptr_t)ret_copy;
27060 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27061 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
27062 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
27063 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27064 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27065 CVec_u8Z_free(ret_var);
27069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27070 LDKu8slice ser_ref;
27071 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27072 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27073 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
27074 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
27075 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27076 return (int64_t)ret_conv;
27079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27080 if ((this_ptr & 1) != 0) return;
27081 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27082 CHECK_ACCESS(this_ptr_ptr);
27083 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
27084 FREE((void*)this_ptr);
27085 BaseSign_free(this_ptr_conv);
27088 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
27089 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27090 *ret_ret = Sign_clone(arg);
27091 return (int64_t)ret_ret;
27093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27094 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
27095 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
27096 LDKSign* arg_conv = (LDKSign*)arg_ptr;
27097 int64_t ret_val = Sign_clone_ptr(arg_conv);
27101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27102 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
27103 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
27104 LDKSign* orig_conv = (LDKSign*)orig_ptr;
27105 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27106 *ret_ret = Sign_clone(orig_conv);
27107 return (int64_t)ret_ret;
27110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27111 if ((this_ptr & 1) != 0) return;
27112 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27113 CHECK_ACCESS(this_ptr_ptr);
27114 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
27115 FREE((void*)this_ptr);
27116 Sign_free(this_ptr_conv);
27119 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27120 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
27121 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
27125 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
27126 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
27130 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
27131 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
27135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27136 if ((this_ptr & 1) != 0) return;
27137 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27138 CHECK_ACCESS(this_ptr_ptr);
27139 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
27140 FREE((void*)this_ptr);
27141 KeysInterface_free(this_ptr_conv);
27144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27145 LDKInMemorySigner this_obj_conv;
27146 this_obj_conv.inner = (void*)(this_obj & (~1));
27147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27149 InMemorySigner_free(this_obj_conv);
27152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27153 LDKInMemorySigner this_ptr_conv;
27154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27155 this_ptr_conv.is_owned = false;
27156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27157 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27158 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
27162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27163 LDKInMemorySigner this_ptr_conv;
27164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27165 this_ptr_conv.is_owned = false;
27166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27167 LDKSecretKey val_ref;
27168 CHECK((*env)->GetArrayLength(env, val) == 32);
27169 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27170 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
27173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27174 LDKInMemorySigner this_ptr_conv;
27175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27176 this_ptr_conv.is_owned = false;
27177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27178 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27179 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
27183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27184 LDKInMemorySigner this_ptr_conv;
27185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27186 this_ptr_conv.is_owned = false;
27187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27188 LDKSecretKey val_ref;
27189 CHECK((*env)->GetArrayLength(env, val) == 32);
27190 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27191 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
27194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27195 LDKInMemorySigner this_ptr_conv;
27196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27197 this_ptr_conv.is_owned = false;
27198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27199 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27200 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
27204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27205 LDKInMemorySigner this_ptr_conv;
27206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27207 this_ptr_conv.is_owned = false;
27208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27209 LDKSecretKey val_ref;
27210 CHECK((*env)->GetArrayLength(env, val) == 32);
27211 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27212 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
27215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27216 LDKInMemorySigner this_ptr_conv;
27217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27218 this_ptr_conv.is_owned = false;
27219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27220 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
27225 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) {
27226 LDKInMemorySigner this_ptr_conv;
27227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27228 this_ptr_conv.is_owned = false;
27229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27230 LDKSecretKey val_ref;
27231 CHECK((*env)->GetArrayLength(env, val) == 32);
27232 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27233 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
27236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27237 LDKInMemorySigner this_ptr_conv;
27238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27239 this_ptr_conv.is_owned = false;
27240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27241 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27242 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
27246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27247 LDKInMemorySigner this_ptr_conv;
27248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27249 this_ptr_conv.is_owned = false;
27250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27251 LDKSecretKey val_ref;
27252 CHECK((*env)->GetArrayLength(env, val) == 32);
27253 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27254 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
27257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
27258 LDKInMemorySigner this_ptr_conv;
27259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27260 this_ptr_conv.is_owned = false;
27261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27262 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27263 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
27267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27268 LDKInMemorySigner this_ptr_conv;
27269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27270 this_ptr_conv.is_owned = false;
27271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27272 LDKThirtyTwoBytes val_ref;
27273 CHECK((*env)->GetArrayLength(env, val) == 32);
27274 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27275 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
27278 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
27279 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
27280 int64_t ret_ref = 0;
27281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27284 ret_ref = (uintptr_t)ret_var.inner;
27285 if (ret_var.is_owned) {
27290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27291 LDKInMemorySigner arg_conv;
27292 arg_conv.inner = (void*)(arg & (~1));
27293 arg_conv.is_owned = false;
27294 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27295 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
27299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27300 LDKInMemorySigner orig_conv;
27301 orig_conv.inner = (void*)(orig & (~1));
27302 orig_conv.is_owned = false;
27303 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27304 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
27305 int64_t ret_ref = 0;
27306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27309 ret_ref = (uintptr_t)ret_var.inner;
27310 if (ret_var.is_owned) {
27316 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) {
27317 LDKSecretKey node_secret_ref;
27318 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
27319 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
27320 LDKSecretKey funding_key_ref;
27321 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
27322 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
27323 LDKSecretKey revocation_base_key_ref;
27324 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
27325 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
27326 LDKSecretKey payment_key_ref;
27327 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
27328 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
27329 LDKSecretKey delayed_payment_base_key_ref;
27330 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
27331 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
27332 LDKSecretKey htlc_base_key_ref;
27333 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
27334 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
27335 LDKThirtyTwoBytes commitment_seed_ref;
27336 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
27337 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
27338 LDKThirtyTwoBytes channel_keys_id_ref;
27339 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
27340 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
27341 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);
27342 int64_t ret_ref = 0;
27343 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27344 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27346 ret_ref = (uintptr_t)ret_var.inner;
27347 if (ret_var.is_owned) {
27353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
27354 LDKInMemorySigner this_arg_conv;
27355 this_arg_conv.inner = (void*)(this_arg & (~1));
27356 this_arg_conv.is_owned = false;
27357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27358 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
27359 int64_t ret_ref = 0;
27360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27363 ret_ref = (uintptr_t)ret_var.inner;
27364 if (ret_var.is_owned) {
27370 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27371 LDKInMemorySigner this_arg_conv;
27372 this_arg_conv.inner = (void*)(this_arg & (~1));
27373 this_arg_conv.is_owned = false;
27374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27375 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27379 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27380 LDKInMemorySigner this_arg_conv;
27381 this_arg_conv.inner = (void*)(this_arg & (~1));
27382 this_arg_conv.is_owned = false;
27383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27384 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
27389 LDKInMemorySigner this_arg_conv;
27390 this_arg_conv.inner = (void*)(this_arg & (~1));
27391 this_arg_conv.is_owned = false;
27392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27393 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
27397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
27398 LDKInMemorySigner this_arg_conv;
27399 this_arg_conv.inner = (void*)(this_arg & (~1));
27400 this_arg_conv.is_owned = false;
27401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27402 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27403 int64_t ret_ref = 0;
27404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27407 ret_ref = (uintptr_t)ret_var.inner;
27408 if (ret_var.is_owned) {
27414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
27415 LDKInMemorySigner this_arg_conv;
27416 this_arg_conv.inner = (void*)(this_arg & (~1));
27417 this_arg_conv.is_owned = false;
27418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27419 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27420 int64_t ret_ref = 0;
27421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27424 ret_ref = (uintptr_t)ret_var.inner;
27425 if (ret_var.is_owned) {
27431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
27432 LDKInMemorySigner this_arg_conv;
27433 this_arg_conv.inner = (void*)(this_arg & (~1));
27434 this_arg_conv.is_owned = false;
27435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27436 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
27440 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) {
27441 LDKInMemorySigner this_arg_conv;
27442 this_arg_conv.inner = (void*)(this_arg & (~1));
27443 this_arg_conv.is_owned = false;
27444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27445 LDKTransaction spend_tx_ref;
27446 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27447 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27448 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27449 spend_tx_ref.data_is_owned = true;
27450 LDKStaticPaymentOutputDescriptor descriptor_conv;
27451 descriptor_conv.inner = (void*)(descriptor & (~1));
27452 descriptor_conv.is_owned = false;
27453 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27454 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27455 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27456 return (int64_t)ret_conv;
27459 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) {
27460 LDKInMemorySigner this_arg_conv;
27461 this_arg_conv.inner = (void*)(this_arg & (~1));
27462 this_arg_conv.is_owned = false;
27463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27464 LDKTransaction spend_tx_ref;
27465 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27466 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27467 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27468 spend_tx_ref.data_is_owned = true;
27469 LDKDelayedPaymentOutputDescriptor descriptor_conv;
27470 descriptor_conv.inner = (void*)(descriptor & (~1));
27471 descriptor_conv.is_owned = false;
27472 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27473 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27474 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27475 return (int64_t)ret_conv;
27478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
27479 LDKInMemorySigner this_arg_conv;
27480 this_arg_conv.inner = (void*)(this_arg & (~1));
27481 this_arg_conv.is_owned = false;
27482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27483 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
27484 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
27485 return (int64_t)ret_ret;
27488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
27489 LDKInMemorySigner this_arg_conv;
27490 this_arg_conv.inner = (void*)(this_arg & (~1));
27491 this_arg_conv.is_owned = false;
27492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27493 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27494 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
27495 return (int64_t)ret_ret;
27498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
27499 LDKInMemorySigner obj_conv;
27500 obj_conv.inner = (void*)(obj & (~1));
27501 obj_conv.is_owned = false;
27502 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27503 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27504 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27505 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27506 CVec_u8Z_free(ret_var);
27510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
27511 LDKu8slice ser_ref;
27512 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27513 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27514 LDKSecretKey arg_ref;
27515 CHECK((*env)->GetArrayLength(env, arg) == 32);
27516 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
27517 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27518 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
27519 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27520 return (int64_t)ret_conv;
27523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27524 LDKKeysManager this_obj_conv;
27525 this_obj_conv.inner = (void*)(this_obj & (~1));
27526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27528 KeysManager_free(this_obj_conv);
27531 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) {
27532 unsigned char seed_arr[32];
27533 CHECK((*env)->GetArrayLength(env, seed) == 32);
27534 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27535 unsigned char (*seed_ref)[32] = &seed_arr;
27536 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27537 int64_t ret_ref = 0;
27538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27541 ret_ref = (uintptr_t)ret_var.inner;
27542 if (ret_var.is_owned) {
27548 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) {
27549 LDKKeysManager this_arg_conv;
27550 this_arg_conv.inner = (void*)(this_arg & (~1));
27551 this_arg_conv.is_owned = false;
27552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27553 unsigned char params_arr[32];
27554 CHECK((*env)->GetArrayLength(env, params) == 32);
27555 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27556 unsigned char (*params_ref)[32] = ¶ms_arr;
27557 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27558 int64_t ret_ref = 0;
27559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27562 ret_ref = (uintptr_t)ret_var.inner;
27563 if (ret_var.is_owned) {
27569 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) {
27570 LDKKeysManager this_arg_conv;
27571 this_arg_conv.inner = (void*)(this_arg & (~1));
27572 this_arg_conv.is_owned = false;
27573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27574 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27575 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27576 if (descriptors_constr.datalen > 0)
27577 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27579 descriptors_constr.data = NULL;
27580 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27581 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27582 int64_t descriptors_conv_27 = descriptors_vals[b];
27583 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27584 CHECK_ACCESS(descriptors_conv_27_ptr);
27585 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27586 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27587 descriptors_constr.data[b] = descriptors_conv_27_conv;
27589 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27590 LDKCVec_TxOutZ outputs_constr;
27591 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27592 if (outputs_constr.datalen > 0)
27593 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27595 outputs_constr.data = NULL;
27596 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27597 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27598 int64_t outputs_conv_7 = outputs_vals[h];
27599 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27600 CHECK_ACCESS(outputs_conv_7_ptr);
27601 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27602 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27603 outputs_constr.data[h] = outputs_conv_7_conv;
27605 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27606 LDKCVec_u8Z change_destination_script_ref;
27607 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27608 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27609 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27610 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27611 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27612 return (int64_t)ret_conv;
27615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27616 LDKKeysManager this_arg_conv;
27617 this_arg_conv.inner = (void*)(this_arg & (~1));
27618 this_arg_conv.is_owned = false;
27619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27620 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27621 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
27622 return (int64_t)ret_ret;
27625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27626 LDKPhantomKeysManager this_obj_conv;
27627 this_obj_conv.inner = (void*)(this_obj & (~1));
27628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27630 PhantomKeysManager_free(this_obj_conv);
27633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27634 LDKPhantomKeysManager this_arg_conv;
27635 this_arg_conv.inner = (void*)(this_arg & (~1));
27636 this_arg_conv.is_owned = false;
27637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27638 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27639 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
27640 return (int64_t)ret_ret;
27643 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) {
27644 unsigned char seed_arr[32];
27645 CHECK((*env)->GetArrayLength(env, seed) == 32);
27646 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27647 unsigned char (*seed_ref)[32] = &seed_arr;
27648 unsigned char cross_node_seed_arr[32];
27649 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
27650 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
27651 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27652 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27653 int64_t ret_ref = 0;
27654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27657 ret_ref = (uintptr_t)ret_var.inner;
27658 if (ret_var.is_owned) {
27664 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) {
27665 LDKPhantomKeysManager this_arg_conv;
27666 this_arg_conv.inner = (void*)(this_arg & (~1));
27667 this_arg_conv.is_owned = false;
27668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27669 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27670 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27671 if (descriptors_constr.datalen > 0)
27672 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27674 descriptors_constr.data = NULL;
27675 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27676 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27677 int64_t descriptors_conv_27 = descriptors_vals[b];
27678 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27679 CHECK_ACCESS(descriptors_conv_27_ptr);
27680 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27681 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27682 descriptors_constr.data[b] = descriptors_conv_27_conv;
27684 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27685 LDKCVec_TxOutZ outputs_constr;
27686 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27687 if (outputs_constr.datalen > 0)
27688 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27690 outputs_constr.data = NULL;
27691 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27692 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27693 int64_t outputs_conv_7 = outputs_vals[h];
27694 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27695 CHECK_ACCESS(outputs_conv_7_ptr);
27696 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27697 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27698 outputs_constr.data[h] = outputs_conv_7_conv;
27700 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27701 LDKCVec_u8Z change_destination_script_ref;
27702 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27703 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27704 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27705 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27706 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27707 return (int64_t)ret_conv;
27710 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) {
27711 LDKPhantomKeysManager this_arg_conv;
27712 this_arg_conv.inner = (void*)(this_arg & (~1));
27713 this_arg_conv.is_owned = false;
27714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27715 unsigned char params_arr[32];
27716 CHECK((*env)->GetArrayLength(env, params) == 32);
27717 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27718 unsigned char (*params_ref)[32] = ¶ms_arr;
27719 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27720 int64_t ret_ref = 0;
27721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27724 ret_ref = (uintptr_t)ret_var.inner;
27725 if (ret_var.is_owned) {
27731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27732 LDKChannelManager this_obj_conv;
27733 this_obj_conv.inner = (void*)(this_obj & (~1));
27734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27736 ChannelManager_free(this_obj_conv);
27739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27740 LDKChainParameters this_obj_conv;
27741 this_obj_conv.inner = (void*)(this_obj & (~1));
27742 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27744 ChainParameters_free(this_obj_conv);
27747 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
27748 LDKChainParameters this_ptr_conv;
27749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27750 this_ptr_conv.is_owned = false;
27751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27752 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
27756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
27757 LDKChainParameters this_ptr_conv;
27758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27759 this_ptr_conv.is_owned = false;
27760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27761 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
27762 ChainParameters_set_network(&this_ptr_conv, val_conv);
27765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
27766 LDKChainParameters this_ptr_conv;
27767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27768 this_ptr_conv.is_owned = false;
27769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27770 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27771 int64_t ret_ref = 0;
27772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27775 ret_ref = (uintptr_t)ret_var.inner;
27776 if (ret_var.is_owned) {
27782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27783 LDKChainParameters this_ptr_conv;
27784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27785 this_ptr_conv.is_owned = false;
27786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27787 LDKBestBlock val_conv;
27788 val_conv.inner = (void*)(val & (~1));
27789 val_conv.is_owned = (val & 1) || (val == 0);
27790 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27791 val_conv = BestBlock_clone(&val_conv);
27792 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
27796 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
27797 LDKBestBlock best_block_arg_conv;
27798 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
27799 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
27800 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27801 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27802 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27803 int64_t ret_ref = 0;
27804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27807 ret_ref = (uintptr_t)ret_var.inner;
27808 if (ret_var.is_owned) {
27814 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27815 LDKChainParameters ret_var = ChainParameters_clone(arg);
27816 int64_t ret_ref = 0;
27817 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27818 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27819 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27820 ret_ref = (uintptr_t)ret_var.inner;
27821 if (ret_var.is_owned) {
27826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27827 LDKChainParameters arg_conv;
27828 arg_conv.inner = (void*)(arg & (~1));
27829 arg_conv.is_owned = false;
27830 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27831 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
27835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27836 LDKChainParameters orig_conv;
27837 orig_conv.inner = (void*)(orig & (~1));
27838 orig_conv.is_owned = false;
27839 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27840 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27841 int64_t ret_ref = 0;
27842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27845 ret_ref = (uintptr_t)ret_var.inner;
27846 if (ret_var.is_owned) {
27852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27853 LDKCounterpartyForwardingInfo this_obj_conv;
27854 this_obj_conv.inner = (void*)(this_obj & (~1));
27855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27857 CounterpartyForwardingInfo_free(this_obj_conv);
27860 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27861 LDKCounterpartyForwardingInfo this_ptr_conv;
27862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27863 this_ptr_conv.is_owned = false;
27864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27865 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27870 LDKCounterpartyForwardingInfo this_ptr_conv;
27871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27872 this_ptr_conv.is_owned = false;
27873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27874 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27877 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27878 LDKCounterpartyForwardingInfo this_ptr_conv;
27879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27880 this_ptr_conv.is_owned = false;
27881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27882 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27887 LDKCounterpartyForwardingInfo this_ptr_conv;
27888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27889 this_ptr_conv.is_owned = false;
27890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27891 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27894 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27895 LDKCounterpartyForwardingInfo this_ptr_conv;
27896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27897 this_ptr_conv.is_owned = false;
27898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27899 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27904 LDKCounterpartyForwardingInfo this_ptr_conv;
27905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27906 this_ptr_conv.is_owned = false;
27907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27908 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27911 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) {
27912 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27913 int64_t ret_ref = 0;
27914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27917 ret_ref = (uintptr_t)ret_var.inner;
27918 if (ret_var.is_owned) {
27924 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27925 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27926 int64_t ret_ref = 0;
27927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27930 ret_ref = (uintptr_t)ret_var.inner;
27931 if (ret_var.is_owned) {
27936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27937 LDKCounterpartyForwardingInfo arg_conv;
27938 arg_conv.inner = (void*)(arg & (~1));
27939 arg_conv.is_owned = false;
27940 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27941 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27946 LDKCounterpartyForwardingInfo orig_conv;
27947 orig_conv.inner = (void*)(orig & (~1));
27948 orig_conv.is_owned = false;
27949 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27950 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27951 int64_t ret_ref = 0;
27952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27955 ret_ref = (uintptr_t)ret_var.inner;
27956 if (ret_var.is_owned) {
27962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27963 LDKChannelCounterparty this_obj_conv;
27964 this_obj_conv.inner = (void*)(this_obj & (~1));
27965 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27967 ChannelCounterparty_free(this_obj_conv);
27970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27971 LDKChannelCounterparty this_ptr_conv;
27972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27973 this_ptr_conv.is_owned = false;
27974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27975 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27976 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
27980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27981 LDKChannelCounterparty this_ptr_conv;
27982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27983 this_ptr_conv.is_owned = false;
27984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27985 LDKPublicKey val_ref;
27986 CHECK((*env)->GetArrayLength(env, val) == 33);
27987 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27988 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27992 LDKChannelCounterparty this_ptr_conv;
27993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27994 this_ptr_conv.is_owned = false;
27995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27996 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27997 int64_t ret_ref = 0;
27998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28001 ret_ref = (uintptr_t)ret_var.inner;
28002 if (ret_var.is_owned) {
28008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28009 LDKChannelCounterparty this_ptr_conv;
28010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28011 this_ptr_conv.is_owned = false;
28012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28013 LDKInitFeatures val_conv;
28014 val_conv.inner = (void*)(val & (~1));
28015 val_conv.is_owned = (val & 1) || (val == 0);
28016 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28017 val_conv = InitFeatures_clone(&val_conv);
28018 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
28021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28022 LDKChannelCounterparty this_ptr_conv;
28023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28024 this_ptr_conv.is_owned = false;
28025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28026 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
28030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28031 LDKChannelCounterparty this_ptr_conv;
28032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28033 this_ptr_conv.is_owned = false;
28034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28035 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
28038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28039 LDKChannelCounterparty this_ptr_conv;
28040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28041 this_ptr_conv.is_owned = false;
28042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28043 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
28044 int64_t ret_ref = 0;
28045 if ((uintptr_t)ret_var.inner > 4096) {
28046 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28047 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28049 ret_ref = (uintptr_t)ret_var.inner;
28050 if (ret_var.is_owned) {
28057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28058 LDKChannelCounterparty this_ptr_conv;
28059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28060 this_ptr_conv.is_owned = false;
28061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28062 LDKCounterpartyForwardingInfo val_conv;
28063 val_conv.inner = (void*)(val & (~1));
28064 val_conv.is_owned = (val & 1) || (val == 0);
28065 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28066 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
28067 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
28070 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) {
28071 LDKPublicKey node_id_arg_ref;
28072 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
28073 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
28074 LDKInitFeatures features_arg_conv;
28075 features_arg_conv.inner = (void*)(features_arg & (~1));
28076 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28077 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28078 features_arg_conv = InitFeatures_clone(&features_arg_conv);
28079 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
28080 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
28081 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
28082 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
28083 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
28084 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
28085 int64_t ret_ref = 0;
28086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28089 ret_ref = (uintptr_t)ret_var.inner;
28090 if (ret_var.is_owned) {
28096 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
28097 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
28098 int64_t ret_ref = 0;
28099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28102 ret_ref = (uintptr_t)ret_var.inner;
28103 if (ret_var.is_owned) {
28108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28109 LDKChannelCounterparty arg_conv;
28110 arg_conv.inner = (void*)(arg & (~1));
28111 arg_conv.is_owned = false;
28112 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28113 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
28117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28118 LDKChannelCounterparty orig_conv;
28119 orig_conv.inner = (void*)(orig & (~1));
28120 orig_conv.is_owned = false;
28121 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28122 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
28123 int64_t ret_ref = 0;
28124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28127 ret_ref = (uintptr_t)ret_var.inner;
28128 if (ret_var.is_owned) {
28134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28135 LDKChannelDetails this_obj_conv;
28136 this_obj_conv.inner = (void*)(this_obj & (~1));
28137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28139 ChannelDetails_free(this_obj_conv);
28142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28143 LDKChannelDetails this_ptr_conv;
28144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28145 this_ptr_conv.is_owned = false;
28146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28147 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28148 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
28152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28153 LDKChannelDetails this_ptr_conv;
28154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28155 this_ptr_conv.is_owned = false;
28156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28157 LDKThirtyTwoBytes val_ref;
28158 CHECK((*env)->GetArrayLength(env, val) == 32);
28159 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28160 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
28163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
28164 LDKChannelDetails this_ptr_conv;
28165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28166 this_ptr_conv.is_owned = false;
28167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28168 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
28169 int64_t ret_ref = 0;
28170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28173 ret_ref = (uintptr_t)ret_var.inner;
28174 if (ret_var.is_owned) {
28180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28181 LDKChannelDetails this_ptr_conv;
28182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28183 this_ptr_conv.is_owned = false;
28184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28185 LDKChannelCounterparty val_conv;
28186 val_conv.inner = (void*)(val & (~1));
28187 val_conv.is_owned = (val & 1) || (val == 0);
28188 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28189 val_conv = ChannelCounterparty_clone(&val_conv);
28190 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
28193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
28194 LDKChannelDetails this_ptr_conv;
28195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28196 this_ptr_conv.is_owned = false;
28197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28198 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
28199 int64_t ret_ref = 0;
28200 if ((uintptr_t)ret_var.inner > 4096) {
28201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28204 ret_ref = (uintptr_t)ret_var.inner;
28205 if (ret_var.is_owned) {
28212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28213 LDKChannelDetails this_ptr_conv;
28214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28215 this_ptr_conv.is_owned = false;
28216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28217 LDKOutPoint val_conv;
28218 val_conv.inner = (void*)(val & (~1));
28219 val_conv.is_owned = (val & 1) || (val == 0);
28220 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28221 val_conv = OutPoint_clone(&val_conv);
28222 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
28225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
28226 LDKChannelDetails this_ptr_conv;
28227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28228 this_ptr_conv.is_owned = false;
28229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28230 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28231 int64_t ret_ref = 0;
28232 if ((uintptr_t)ret_var.inner > 4096) {
28233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28236 ret_ref = (uintptr_t)ret_var.inner;
28237 if (ret_var.is_owned) {
28244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28245 LDKChannelDetails this_ptr_conv;
28246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28247 this_ptr_conv.is_owned = false;
28248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28249 LDKChannelTypeFeatures val_conv;
28250 val_conv.inner = (void*)(val & (~1));
28251 val_conv.is_owned = (val & 1) || (val == 0);
28252 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28253 val_conv = ChannelTypeFeatures_clone(&val_conv);
28254 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28258 LDKChannelDetails this_ptr_conv;
28259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28260 this_ptr_conv.is_owned = false;
28261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28262 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28263 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28264 int64_t ret_ref = (uintptr_t)ret_copy;
28268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28269 LDKChannelDetails this_ptr_conv;
28270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28271 this_ptr_conv.is_owned = false;
28272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28273 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28274 CHECK_ACCESS(val_ptr);
28275 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28276 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28277 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28281 LDKChannelDetails this_ptr_conv;
28282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28283 this_ptr_conv.is_owned = false;
28284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28285 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28286 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
28287 int64_t ret_ref = (uintptr_t)ret_copy;
28291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28292 LDKChannelDetails this_ptr_conv;
28293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28294 this_ptr_conv.is_owned = false;
28295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28296 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28297 CHECK_ACCESS(val_ptr);
28298 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28299 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28300 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
28303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28304 LDKChannelDetails this_ptr_conv;
28305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28306 this_ptr_conv.is_owned = false;
28307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28308 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
28312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28313 LDKChannelDetails this_ptr_conv;
28314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28315 this_ptr_conv.is_owned = false;
28316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28317 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
28320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28321 LDKChannelDetails this_ptr_conv;
28322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28323 this_ptr_conv.is_owned = false;
28324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28325 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28326 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
28327 int64_t ret_ref = (uintptr_t)ret_copy;
28331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28332 LDKChannelDetails this_ptr_conv;
28333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28334 this_ptr_conv.is_owned = false;
28335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28336 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28337 CHECK_ACCESS(val_ptr);
28338 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28339 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28340 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28344 LDKChannelDetails this_ptr_conv;
28345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28346 this_ptr_conv.is_owned = false;
28347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28348 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
28352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28353 LDKChannelDetails this_ptr_conv;
28354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28355 this_ptr_conv.is_owned = false;
28356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28357 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
28360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28361 LDKChannelDetails this_ptr_conv;
28362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28363 this_ptr_conv.is_owned = false;
28364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28365 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
28369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28370 LDKChannelDetails this_ptr_conv;
28371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28372 this_ptr_conv.is_owned = false;
28373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28374 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28378 LDKChannelDetails 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 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28387 LDKChannelDetails this_ptr_conv;
28388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28389 this_ptr_conv.is_owned = false;
28390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28391 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28395 LDKChannelDetails this_ptr_conv;
28396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28397 this_ptr_conv.is_owned = false;
28398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28399 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28404 LDKChannelDetails this_ptr_conv;
28405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28406 this_ptr_conv.is_owned = false;
28407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28408 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
28412 LDKChannelDetails this_ptr_conv;
28413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28414 this_ptr_conv.is_owned = false;
28415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28416 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28417 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28418 int64_t ret_ref = (uintptr_t)ret_copy;
28422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28423 LDKChannelDetails this_ptr_conv;
28424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28425 this_ptr_conv.is_owned = false;
28426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28427 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28428 CHECK_ACCESS(val_ptr);
28429 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28430 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
28431 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28435 LDKChannelDetails this_ptr_conv;
28436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28437 this_ptr_conv.is_owned = false;
28438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28439 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28440 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28441 int64_t ret_ref = (uintptr_t)ret_copy;
28445 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) {
28446 LDKChannelDetails this_ptr_conv;
28447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28448 this_ptr_conv.is_owned = false;
28449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28450 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28451 CHECK_ACCESS(val_ptr);
28452 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28453 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
28454 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
28458 LDKChannelDetails this_ptr_conv;
28459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28460 this_ptr_conv.is_owned = false;
28461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28462 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
28466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28467 LDKChannelDetails this_ptr_conv;
28468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28469 this_ptr_conv.is_owned = false;
28470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28471 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
28475 LDKChannelDetails this_ptr_conv;
28476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28477 this_ptr_conv.is_owned = false;
28478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28479 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
28483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28484 LDKChannelDetails this_ptr_conv;
28485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28486 this_ptr_conv.is_owned = false;
28487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28488 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
28491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
28492 LDKChannelDetails this_ptr_conv;
28493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28494 this_ptr_conv.is_owned = false;
28495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28496 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
28500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28501 LDKChannelDetails this_ptr_conv;
28502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28503 this_ptr_conv.is_owned = false;
28504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28505 ChannelDetails_set_is_usable(&this_ptr_conv, val);
28508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
28509 LDKChannelDetails this_ptr_conv;
28510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28511 this_ptr_conv.is_owned = false;
28512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28513 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
28517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28518 LDKChannelDetails this_ptr_conv;
28519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28520 this_ptr_conv.is_owned = false;
28521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28522 ChannelDetails_set_is_public(&this_ptr_conv, val);
28525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
28526 LDKThirtyTwoBytes channel_id_arg_ref;
28527 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28528 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28529 LDKChannelCounterparty counterparty_arg_conv;
28530 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
28531 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
28532 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28533 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28534 LDKOutPoint funding_txo_arg_conv;
28535 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
28536 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
28537 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28538 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28539 LDKChannelTypeFeatures channel_type_arg_conv;
28540 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
28541 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
28542 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28543 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28544 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
28545 CHECK_ACCESS(short_channel_id_arg_ptr);
28546 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28547 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
28548 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
28549 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28550 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28551 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
28552 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
28553 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28554 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28555 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
28556 CHECK_ACCESS(confirmations_required_arg_ptr);
28557 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28558 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
28559 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
28560 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28561 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28562 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
28563 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
28564 int64_t ret_ref = 0;
28565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28568 ret_ref = (uintptr_t)ret_var.inner;
28569 if (ret_var.is_owned) {
28575 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28576 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28577 int64_t ret_ref = 0;
28578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28581 ret_ref = (uintptr_t)ret_var.inner;
28582 if (ret_var.is_owned) {
28587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28588 LDKChannelDetails arg_conv;
28589 arg_conv.inner = (void*)(arg & (~1));
28590 arg_conv.is_owned = false;
28591 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28592 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
28596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28597 LDKChannelDetails orig_conv;
28598 orig_conv.inner = (void*)(orig & (~1));
28599 orig_conv.is_owned = false;
28600 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28601 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28602 int64_t ret_ref = 0;
28603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28606 ret_ref = (uintptr_t)ret_var.inner;
28607 if (ret_var.is_owned) {
28613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
28614 LDKChannelDetails this_arg_conv;
28615 this_arg_conv.inner = (void*)(this_arg & (~1));
28616 this_arg_conv.is_owned = false;
28617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28618 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28619 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28620 int64_t ret_ref = (uintptr_t)ret_copy;
28624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28625 if ((this_ptr & 1) != 0) return;
28626 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28627 CHECK_ACCESS(this_ptr_ptr);
28628 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
28629 FREE((void*)this_ptr);
28630 PaymentSendFailure_free(this_ptr_conv);
28633 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
28634 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28635 *ret_copy = PaymentSendFailure_clone(arg);
28636 int64_t ret_ref = (uintptr_t)ret_copy;
28639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28640 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
28641 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
28645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28646 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
28647 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28648 *ret_copy = PaymentSendFailure_clone(orig_conv);
28649 int64_t ret_ref = (uintptr_t)ret_copy;
28653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
28654 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
28655 CHECK_ACCESS(a_ptr);
28656 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
28657 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
28658 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28659 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
28660 int64_t ret_ref = (uintptr_t)ret_copy;
28664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
28665 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
28666 a_constr.datalen = (*env)->GetArrayLength(env, a);
28667 if (a_constr.datalen > 0)
28668 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28670 a_constr.data = NULL;
28671 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28672 for (size_t w = 0; w < a_constr.datalen; w++) {
28673 int64_t a_conv_22 = a_vals[w];
28674 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
28675 CHECK_ACCESS(a_conv_22_ptr);
28676 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
28677 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
28678 a_constr.data[w] = a_conv_22_conv;
28680 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28681 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28682 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
28683 int64_t ret_ref = (uintptr_t)ret_copy;
28687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
28688 LDKCVec_APIErrorZ a_constr;
28689 a_constr.datalen = (*env)->GetArrayLength(env, a);
28690 if (a_constr.datalen > 0)
28691 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
28693 a_constr.data = NULL;
28694 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28695 for (size_t k = 0; k < a_constr.datalen; k++) {
28696 int64_t a_conv_10 = a_vals[k];
28697 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
28698 CHECK_ACCESS(a_conv_10_ptr);
28699 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
28700 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
28701 a_constr.data[k] = a_conv_10_conv;
28703 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28704 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28705 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
28706 int64_t ret_ref = (uintptr_t)ret_copy;
28710 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) {
28711 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
28712 results_constr.datalen = (*env)->GetArrayLength(env, results);
28713 if (results_constr.datalen > 0)
28714 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28716 results_constr.data = NULL;
28717 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
28718 for (size_t w = 0; w < results_constr.datalen; w++) {
28719 int64_t results_conv_22 = results_vals[w];
28720 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
28721 CHECK_ACCESS(results_conv_22_ptr);
28722 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
28723 results_constr.data[w] = results_conv_22_conv;
28725 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
28726 LDKRouteParameters failed_paths_retry_conv;
28727 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
28728 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
28729 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
28730 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
28731 LDKThirtyTwoBytes payment_id_ref;
28732 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28733 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28734 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28735 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
28736 int64_t ret_ref = (uintptr_t)ret_copy;
28740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28741 LDKPhantomRouteHints this_obj_conv;
28742 this_obj_conv.inner = (void*)(this_obj & (~1));
28743 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28745 PhantomRouteHints_free(this_obj_conv);
28748 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
28749 LDKPhantomRouteHints this_ptr_conv;
28750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28751 this_ptr_conv.is_owned = false;
28752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28753 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28754 int64_tArray ret_arr = NULL;
28755 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28756 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28757 for (size_t q = 0; q < ret_var.datalen; q++) {
28758 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28759 int64_t ret_conv_16_ref = 0;
28760 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28761 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28763 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28764 if (ret_conv_16_var.is_owned) {
28765 ret_conv_16_ref |= 1;
28767 ret_arr_ptr[q] = ret_conv_16_ref;
28769 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28770 FREE(ret_var.data);
28774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28775 LDKPhantomRouteHints this_ptr_conv;
28776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28777 this_ptr_conv.is_owned = false;
28778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28779 LDKCVec_ChannelDetailsZ val_constr;
28780 val_constr.datalen = (*env)->GetArrayLength(env, val);
28781 if (val_constr.datalen > 0)
28782 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28784 val_constr.data = NULL;
28785 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28786 for (size_t q = 0; q < val_constr.datalen; q++) {
28787 int64_t val_conv_16 = val_vals[q];
28788 LDKChannelDetails val_conv_16_conv;
28789 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
28790 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
28791 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28792 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28793 val_constr.data[q] = val_conv_16_conv;
28795 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28796 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28800 LDKPhantomRouteHints this_ptr_conv;
28801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28802 this_ptr_conv.is_owned = false;
28803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28804 int64_t ret_val = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28809 LDKPhantomRouteHints this_ptr_conv;
28810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28811 this_ptr_conv.is_owned = false;
28812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28813 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28817 LDKPhantomRouteHints this_ptr_conv;
28818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28819 this_ptr_conv.is_owned = false;
28820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28821 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28822 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
28826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28827 LDKPhantomRouteHints this_ptr_conv;
28828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28829 this_ptr_conv.is_owned = false;
28830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28831 LDKPublicKey val_ref;
28832 CHECK((*env)->GetArrayLength(env, val) == 33);
28833 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28834 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28837 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) {
28838 LDKCVec_ChannelDetailsZ channels_arg_constr;
28839 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28840 if (channels_arg_constr.datalen > 0)
28841 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28843 channels_arg_constr.data = NULL;
28844 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28845 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28846 int64_t channels_arg_conv_16 = channels_arg_vals[q];
28847 LDKChannelDetails channels_arg_conv_16_conv;
28848 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
28849 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
28850 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28851 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28852 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28854 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28855 LDKPublicKey real_node_pubkey_arg_ref;
28856 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
28857 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
28858 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28859 int64_t ret_ref = 0;
28860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28863 ret_ref = (uintptr_t)ret_var.inner;
28864 if (ret_var.is_owned) {
28870 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28871 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28872 int64_t ret_ref = 0;
28873 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28874 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28876 ret_ref = (uintptr_t)ret_var.inner;
28877 if (ret_var.is_owned) {
28882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28883 LDKPhantomRouteHints arg_conv;
28884 arg_conv.inner = (void*)(arg & (~1));
28885 arg_conv.is_owned = false;
28886 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28887 int64_t ret_val = PhantomRouteHints_clone_ptr(&arg_conv);
28891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28892 LDKPhantomRouteHints orig_conv;
28893 orig_conv.inner = (void*)(orig & (~1));
28894 orig_conv.is_owned = false;
28895 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28896 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28897 int64_t ret_ref = 0;
28898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28901 ret_ref = (uintptr_t)ret_var.inner;
28902 if (ret_var.is_owned) {
28908 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) {
28909 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
28910 CHECK_ACCESS(fee_est_ptr);
28911 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28912 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28913 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28914 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28916 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
28917 CHECK_ACCESS(chain_monitor_ptr);
28918 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28919 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28920 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28921 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28923 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
28924 CHECK_ACCESS(tx_broadcaster_ptr);
28925 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28926 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28927 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28928 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28930 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
28931 CHECK_ACCESS(logger_ptr);
28932 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28933 if (logger_conv.free == LDKLogger_JCalls_free) {
28934 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28935 LDKLogger_JCalls_cloned(&logger_conv);
28937 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
28938 CHECK_ACCESS(keys_manager_ptr);
28939 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28940 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28941 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28942 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28944 LDKUserConfig config_conv;
28945 config_conv.inner = (void*)(config & (~1));
28946 config_conv.is_owned = (config & 1) || (config == 0);
28947 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28948 config_conv = UserConfig_clone(&config_conv);
28949 LDKChainParameters params_conv;
28950 params_conv.inner = (void*)(params & (~1));
28951 params_conv.is_owned = (params & 1) || (params == 0);
28952 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28953 params_conv = ChainParameters_clone(¶ms_conv);
28954 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
28955 int64_t ret_ref = 0;
28956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28959 ret_ref = (uintptr_t)ret_var.inner;
28960 if (ret_var.is_owned) {
28966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(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 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28972 int64_t ret_ref = 0;
28973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28976 ret_ref = (uintptr_t)ret_var.inner;
28977 if (ret_var.is_owned) {
28983 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) {
28984 LDKChannelManager this_arg_conv;
28985 this_arg_conv.inner = (void*)(this_arg & (~1));
28986 this_arg_conv.is_owned = false;
28987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28988 LDKPublicKey their_network_key_ref;
28989 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
28990 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
28991 LDKUserConfig override_config_conv;
28992 override_config_conv.inner = (void*)(override_config & (~1));
28993 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
28994 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28995 override_config_conv = UserConfig_clone(&override_config_conv);
28996 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28997 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
28998 return (int64_t)ret_conv;
29001 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29002 LDKChannelManager this_arg_conv;
29003 this_arg_conv.inner = (void*)(this_arg & (~1));
29004 this_arg_conv.is_owned = false;
29005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29006 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
29007 int64_tArray ret_arr = NULL;
29008 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29009 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29010 for (size_t q = 0; q < ret_var.datalen; q++) {
29011 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29012 int64_t ret_conv_16_ref = 0;
29013 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29014 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29016 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29017 if (ret_conv_16_var.is_owned) {
29018 ret_conv_16_ref |= 1;
29020 ret_arr_ptr[q] = ret_conv_16_ref;
29022 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29023 FREE(ret_var.data);
29027 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29028 LDKChannelManager this_arg_conv;
29029 this_arg_conv.inner = (void*)(this_arg & (~1));
29030 this_arg_conv.is_owned = false;
29031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29032 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
29033 int64_tArray ret_arr = NULL;
29034 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29035 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29036 for (size_t q = 0; q < ret_var.datalen; q++) {
29037 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29038 int64_t ret_conv_16_ref = 0;
29039 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29040 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29042 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29043 if (ret_conv_16_var.is_owned) {
29044 ret_conv_16_ref |= 1;
29046 ret_arr_ptr[q] = ret_conv_16_ref;
29048 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29049 FREE(ret_var.data);
29053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
29054 LDKChannelManager this_arg_conv;
29055 this_arg_conv.inner = (void*)(this_arg & (~1));
29056 this_arg_conv.is_owned = false;
29057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29058 unsigned char channel_id_arr[32];
29059 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29060 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29061 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29062 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29063 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
29064 return (int64_t)ret_conv;
29067 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) {
29068 LDKChannelManager this_arg_conv;
29069 this_arg_conv.inner = (void*)(this_arg & (~1));
29070 this_arg_conv.is_owned = false;
29071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29072 unsigned char channel_id_arr[32];
29073 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29074 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29075 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29076 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29077 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
29078 return (int64_t)ret_conv;
29081 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) {
29082 LDKChannelManager this_arg_conv;
29083 this_arg_conv.inner = (void*)(this_arg & (~1));
29084 this_arg_conv.is_owned = false;
29085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29086 unsigned char channel_id_arr[32];
29087 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29088 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29089 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29090 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29091 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
29092 return (int64_t)ret_conv;
29095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29096 LDKChannelManager this_arg_conv;
29097 this_arg_conv.inner = (void*)(this_arg & (~1));
29098 this_arg_conv.is_owned = false;
29099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29100 ChannelManager_force_close_all_channels(&this_arg_conv);
29103 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) {
29104 LDKChannelManager this_arg_conv;
29105 this_arg_conv.inner = (void*)(this_arg & (~1));
29106 this_arg_conv.is_owned = false;
29107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29108 LDKRoute route_conv;
29109 route_conv.inner = (void*)(route & (~1));
29110 route_conv.is_owned = false;
29111 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29112 LDKThirtyTwoBytes payment_hash_ref;
29113 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29114 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29115 LDKThirtyTwoBytes payment_secret_ref;
29116 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29117 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29118 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
29119 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
29120 return (int64_t)ret_conv;
29123 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) {
29124 LDKChannelManager this_arg_conv;
29125 this_arg_conv.inner = (void*)(this_arg & (~1));
29126 this_arg_conv.is_owned = false;
29127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29128 LDKRoute route_conv;
29129 route_conv.inner = (void*)(route & (~1));
29130 route_conv.is_owned = false;
29131 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29132 LDKThirtyTwoBytes payment_id_ref;
29133 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29134 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29135 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29136 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
29137 return (int64_t)ret_conv;
29140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
29141 LDKChannelManager this_arg_conv;
29142 this_arg_conv.inner = (void*)(this_arg & (~1));
29143 this_arg_conv.is_owned = false;
29144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29145 LDKThirtyTwoBytes payment_id_ref;
29146 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29147 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29148 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29151 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) {
29152 LDKChannelManager this_arg_conv;
29153 this_arg_conv.inner = (void*)(this_arg & (~1));
29154 this_arg_conv.is_owned = false;
29155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29156 LDKRoute route_conv;
29157 route_conv.inner = (void*)(route & (~1));
29158 route_conv.is_owned = false;
29159 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29160 LDKThirtyTwoBytes payment_preimage_ref;
29161 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29162 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29163 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29164 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
29165 return (int64_t)ret_conv;
29168 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) {
29169 LDKChannelManager this_arg_conv;
29170 this_arg_conv.inner = (void*)(this_arg & (~1));
29171 this_arg_conv.is_owned = false;
29172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29173 unsigned char temporary_channel_id_arr[32];
29174 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29175 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29176 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29177 LDKTransaction funding_transaction_ref;
29178 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
29179 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29180 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
29181 funding_transaction_ref.data_is_owned = true;
29182 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29183 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
29184 return (int64_t)ret_conv;
29187 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) {
29188 LDKChannelManager this_arg_conv;
29189 this_arg_conv.inner = (void*)(this_arg & (~1));
29190 this_arg_conv.is_owned = false;
29191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29192 LDKThreeBytes rgb_ref;
29193 CHECK((*env)->GetArrayLength(env, rgb) == 3);
29194 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
29195 LDKThirtyTwoBytes alias_ref;
29196 CHECK((*env)->GetArrayLength(env, alias) == 32);
29197 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
29198 LDKCVec_NetAddressZ addresses_constr;
29199 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
29200 if (addresses_constr.datalen > 0)
29201 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
29203 addresses_constr.data = NULL;
29204 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
29205 for (size_t m = 0; m < addresses_constr.datalen; m++) {
29206 int64_t addresses_conv_12 = addresses_vals[m];
29207 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
29208 CHECK_ACCESS(addresses_conv_12_ptr);
29209 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
29210 addresses_constr.data[m] = addresses_conv_12_conv;
29212 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
29213 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
29216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
29217 LDKChannelManager this_arg_conv;
29218 this_arg_conv.inner = (void*)(this_arg & (~1));
29219 this_arg_conv.is_owned = false;
29220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29221 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
29225 LDKChannelManager this_arg_conv;
29226 this_arg_conv.inner = (void*)(this_arg & (~1));
29227 this_arg_conv.is_owned = false;
29228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29229 ChannelManager_timer_tick_occurred(&this_arg_conv);
29232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
29233 LDKChannelManager this_arg_conv;
29234 this_arg_conv.inner = (void*)(this_arg & (~1));
29235 this_arg_conv.is_owned = false;
29236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29237 unsigned char payment_hash_arr[32];
29238 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29239 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
29240 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
29241 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
29246 LDKChannelManager this_arg_conv;
29247 this_arg_conv.inner = (void*)(this_arg & (~1));
29248 this_arg_conv.is_owned = false;
29249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29250 LDKThirtyTwoBytes payment_preimage_ref;
29251 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29252 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29253 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
29258 LDKChannelManager this_arg_conv;
29259 this_arg_conv.inner = (void*)(this_arg & (~1));
29260 this_arg_conv.is_owned = false;
29261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29262 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29263 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
29267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t user_channel_id) {
29268 LDKChannelManager this_arg_conv;
29269 this_arg_conv.inner = (void*)(this_arg & (~1));
29270 this_arg_conv.is_owned = false;
29271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29272 unsigned char temporary_channel_id_arr[32];
29273 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29274 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29275 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29276 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29277 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, user_channel_id);
29278 return (int64_t)ret_conv;
29281 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) {
29282 LDKChannelManager this_arg_conv;
29283 this_arg_conv.inner = (void*)(this_arg & (~1));
29284 this_arg_conv.is_owned = false;
29285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29286 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29287 CHECK_ACCESS(min_value_msat_ptr);
29288 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29289 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29290 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29291 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29292 return (int64_t)ret_conv;
29295 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) {
29296 LDKChannelManager this_arg_conv;
29297 this_arg_conv.inner = (void*)(this_arg & (~1));
29298 this_arg_conv.is_owned = false;
29299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29300 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29301 CHECK_ACCESS(min_value_msat_ptr);
29302 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29303 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29304 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29305 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29306 return (int64_t)ret_conv;
29309 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) {
29310 LDKChannelManager this_arg_conv;
29311 this_arg_conv.inner = (void*)(this_arg & (~1));
29312 this_arg_conv.is_owned = false;
29313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29314 LDKThirtyTwoBytes payment_hash_ref;
29315 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29316 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29317 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29318 CHECK_ACCESS(min_value_msat_ptr);
29319 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29320 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29321 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29322 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29323 return (int64_t)ret_conv;
29326 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) {
29327 LDKChannelManager this_arg_conv;
29328 this_arg_conv.inner = (void*)(this_arg & (~1));
29329 this_arg_conv.is_owned = false;
29330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29331 LDKThirtyTwoBytes payment_hash_ref;
29332 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29333 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29334 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29335 CHECK_ACCESS(min_value_msat_ptr);
29336 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29337 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29338 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29339 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29340 return (int64_t)ret_conv;
29343 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) {
29344 LDKChannelManager this_arg_conv;
29345 this_arg_conv.inner = (void*)(this_arg & (~1));
29346 this_arg_conv.is_owned = false;
29347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29348 LDKThirtyTwoBytes payment_hash_ref;
29349 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29350 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29351 LDKThirtyTwoBytes payment_secret_ref;
29352 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29353 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29354 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29355 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29356 return (int64_t)ret_conv;
29359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29360 LDKChannelManager this_arg_conv;
29361 this_arg_conv.inner = (void*)(this_arg & (~1));
29362 this_arg_conv.is_owned = false;
29363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29364 int64_t ret_val = ChannelManager_get_phantom_scid(&this_arg_conv);
29368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
29369 LDKChannelManager this_arg_conv;
29370 this_arg_conv.inner = (void*)(this_arg & (~1));
29371 this_arg_conv.is_owned = false;
29372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29373 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29374 int64_t ret_ref = 0;
29375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29378 ret_ref = (uintptr_t)ret_var.inner;
29379 if (ret_var.is_owned) {
29385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29386 LDKChannelManager this_arg_conv;
29387 this_arg_conv.inner = (void*)(this_arg & (~1));
29388 this_arg_conv.is_owned = false;
29389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29390 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29391 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29392 return (int64_t)ret_ret;
29395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29396 LDKChannelManager this_arg_conv;
29397 this_arg_conv.inner = (void*)(this_arg & (~1));
29398 this_arg_conv.is_owned = false;
29399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29400 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29401 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29402 return (int64_t)ret_ret;
29405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
29406 LDKChannelManager this_arg_conv;
29407 this_arg_conv.inner = (void*)(this_arg & (~1));
29408 this_arg_conv.is_owned = false;
29409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29410 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29411 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29412 return (int64_t)ret_ret;
29415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
29416 LDKChannelManager this_arg_conv;
29417 this_arg_conv.inner = (void*)(this_arg & (~1));
29418 this_arg_conv.is_owned = false;
29419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29420 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29421 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29422 return (int64_t)ret_ret;
29425 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) {
29426 LDKChannelManager this_arg_conv;
29427 this_arg_conv.inner = (void*)(this_arg & (~1));
29428 this_arg_conv.is_owned = false;
29429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29430 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
29434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
29435 LDKChannelManager this_arg_conv;
29436 this_arg_conv.inner = (void*)(this_arg & (~1));
29437 this_arg_conv.is_owned = false;
29438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29439 ChannelManager_await_persistable_update(&this_arg_conv);
29442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
29443 LDKChannelManager this_arg_conv;
29444 this_arg_conv.inner = (void*)(this_arg & (~1));
29445 this_arg_conv.is_owned = false;
29446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29447 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29448 int64_t ret_ref = 0;
29449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29452 ret_ref = (uintptr_t)ret_var.inner;
29453 if (ret_var.is_owned) {
29459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
29460 LDKChannelManager this_arg_conv;
29461 this_arg_conv.inner = (void*)(this_arg & (~1));
29462 this_arg_conv.is_owned = false;
29463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29464 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29465 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29466 return (int64_t)ret_ret;
29469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
29470 LDKCounterpartyForwardingInfo obj_conv;
29471 obj_conv.inner = (void*)(obj & (~1));
29472 obj_conv.is_owned = false;
29473 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29474 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29475 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29476 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29477 CVec_u8Z_free(ret_var);
29481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29482 LDKu8slice ser_ref;
29483 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29484 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29485 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29486 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29487 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29488 return (int64_t)ret_conv;
29491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
29492 LDKChannelCounterparty obj_conv;
29493 obj_conv.inner = (void*)(obj & (~1));
29494 obj_conv.is_owned = false;
29495 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29496 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29497 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29498 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29499 CVec_u8Z_free(ret_var);
29503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29504 LDKu8slice ser_ref;
29505 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29506 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29507 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29508 *ret_conv = ChannelCounterparty_read(ser_ref);
29509 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29510 return (int64_t)ret_conv;
29513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
29514 LDKChannelDetails obj_conv;
29515 obj_conv.inner = (void*)(obj & (~1));
29516 obj_conv.is_owned = false;
29517 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29518 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29519 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29520 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29521 CVec_u8Z_free(ret_var);
29525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29526 LDKu8slice ser_ref;
29527 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29528 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29529 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29530 *ret_conv = ChannelDetails_read(ser_ref);
29531 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29532 return (int64_t)ret_conv;
29535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
29536 LDKPhantomRouteHints obj_conv;
29537 obj_conv.inner = (void*)(obj & (~1));
29538 obj_conv.is_owned = false;
29539 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29540 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29541 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29542 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29543 CVec_u8Z_free(ret_var);
29547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29548 LDKu8slice ser_ref;
29549 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29550 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29551 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29552 *ret_conv = PhantomRouteHints_read(ser_ref);
29553 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29554 return (int64_t)ret_conv;
29557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
29558 LDKChannelManager obj_conv;
29559 obj_conv.inner = (void*)(obj & (~1));
29560 obj_conv.is_owned = false;
29561 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29562 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29563 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29564 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29565 CVec_u8Z_free(ret_var);
29569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29570 LDKChannelManagerReadArgs this_obj_conv;
29571 this_obj_conv.inner = (void*)(this_obj & (~1));
29572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29574 ChannelManagerReadArgs_free(this_obj_conv);
29577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
29578 LDKChannelManagerReadArgs this_ptr_conv;
29579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29580 this_ptr_conv.is_owned = false;
29581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29582 // WARNING: This object doesn't live past this scope, needs clone!
29583 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
29587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29588 LDKChannelManagerReadArgs this_ptr_conv;
29589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29590 this_ptr_conv.is_owned = false;
29591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29592 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29593 CHECK_ACCESS(val_ptr);
29594 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
29595 if (val_conv.free == LDKKeysInterface_JCalls_free) {
29596 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29597 LDKKeysInterface_JCalls_cloned(&val_conv);
29599 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
29602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
29603 LDKChannelManagerReadArgs this_ptr_conv;
29604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29605 this_ptr_conv.is_owned = false;
29606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29607 // WARNING: This object doesn't live past this scope, needs clone!
29608 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
29612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29613 LDKChannelManagerReadArgs this_ptr_conv;
29614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29615 this_ptr_conv.is_owned = false;
29616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29617 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29618 CHECK_ACCESS(val_ptr);
29619 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29620 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29621 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29622 LDKFeeEstimator_JCalls_cloned(&val_conv);
29624 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
29628 LDKChannelManagerReadArgs this_ptr_conv;
29629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29630 this_ptr_conv.is_owned = false;
29631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29632 // WARNING: This object doesn't live past this scope, needs clone!
29633 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
29637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29638 LDKChannelManagerReadArgs this_ptr_conv;
29639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29640 this_ptr_conv.is_owned = false;
29641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29642 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29643 CHECK_ACCESS(val_ptr);
29644 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29645 if (val_conv.free == LDKWatch_JCalls_free) {
29646 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29647 LDKWatch_JCalls_cloned(&val_conv);
29649 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
29653 LDKChannelManagerReadArgs this_ptr_conv;
29654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29655 this_ptr_conv.is_owned = false;
29656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29657 // WARNING: This object doesn't live past this scope, needs clone!
29658 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
29662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29663 LDKChannelManagerReadArgs this_ptr_conv;
29664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29665 this_ptr_conv.is_owned = false;
29666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29667 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29668 CHECK_ACCESS(val_ptr);
29669 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29670 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29671 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29672 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29674 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
29678 LDKChannelManagerReadArgs this_ptr_conv;
29679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29680 this_ptr_conv.is_owned = false;
29681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29682 // WARNING: This object doesn't live past this scope, needs clone!
29683 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
29687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29688 LDKChannelManagerReadArgs this_ptr_conv;
29689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29690 this_ptr_conv.is_owned = false;
29691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29692 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29693 CHECK_ACCESS(val_ptr);
29694 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29695 if (val_conv.free == LDKLogger_JCalls_free) {
29696 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29697 LDKLogger_JCalls_cloned(&val_conv);
29699 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
29703 LDKChannelManagerReadArgs this_ptr_conv;
29704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29705 this_ptr_conv.is_owned = false;
29706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29707 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29708 int64_t ret_ref = 0;
29709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29712 ret_ref = (uintptr_t)ret_var.inner;
29713 if (ret_var.is_owned) {
29719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29720 LDKChannelManagerReadArgs this_ptr_conv;
29721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29722 this_ptr_conv.is_owned = false;
29723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29724 LDKUserConfig val_conv;
29725 val_conv.inner = (void*)(val & (~1));
29726 val_conv.is_owned = (val & 1) || (val == 0);
29727 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29728 val_conv = UserConfig_clone(&val_conv);
29729 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29732 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) {
29733 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
29734 CHECK_ACCESS(keys_manager_ptr);
29735 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29736 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29737 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29738 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29740 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
29741 CHECK_ACCESS(fee_estimator_ptr);
29742 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29743 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29744 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29745 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29747 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
29748 CHECK_ACCESS(chain_monitor_ptr);
29749 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29750 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29751 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29752 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29754 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
29755 CHECK_ACCESS(tx_broadcaster_ptr);
29756 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29757 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29758 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29759 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29761 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
29762 CHECK_ACCESS(logger_ptr);
29763 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29764 if (logger_conv.free == LDKLogger_JCalls_free) {
29765 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29766 LDKLogger_JCalls_cloned(&logger_conv);
29768 LDKUserConfig default_config_conv;
29769 default_config_conv.inner = (void*)(default_config & (~1));
29770 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
29771 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
29772 default_config_conv = UserConfig_clone(&default_config_conv);
29773 LDKCVec_ChannelMonitorZ channel_monitors_constr;
29774 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
29775 if (channel_monitors_constr.datalen > 0)
29776 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
29778 channel_monitors_constr.data = NULL;
29779 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
29780 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
29781 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
29782 LDKChannelMonitor channel_monitors_conv_16_conv;
29783 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
29784 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
29785 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
29786 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
29788 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
29789 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);
29790 int64_t ret_ref = 0;
29791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29794 ret_ref = (uintptr_t)ret_var.inner;
29795 if (ret_var.is_owned) {
29801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
29802 LDKu8slice ser_ref;
29803 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29804 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29805 LDKChannelManagerReadArgs arg_conv;
29806 arg_conv.inner = (void*)(arg & (~1));
29807 arg_conv.is_owned = (arg & 1) || (arg == 0);
29808 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29809 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
29810 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
29811 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
29812 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29813 return (int64_t)ret_conv;
29816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29817 LDKDecodeError this_obj_conv;
29818 this_obj_conv.inner = (void*)(this_obj & (~1));
29819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29821 DecodeError_free(this_obj_conv);
29824 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
29825 LDKDecodeError ret_var = DecodeError_clone(arg);
29826 int64_t ret_ref = 0;
29827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29830 ret_ref = (uintptr_t)ret_var.inner;
29831 if (ret_var.is_owned) {
29836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29837 LDKDecodeError arg_conv;
29838 arg_conv.inner = (void*)(arg & (~1));
29839 arg_conv.is_owned = false;
29840 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29841 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
29845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29846 LDKDecodeError orig_conv;
29847 orig_conv.inner = (void*)(orig & (~1));
29848 orig_conv.is_owned = false;
29849 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29850 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
29851 int64_t ret_ref = 0;
29852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29855 ret_ref = (uintptr_t)ret_var.inner;
29856 if (ret_var.is_owned) {
29862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29863 LDKInit this_obj_conv;
29864 this_obj_conv.inner = (void*)(this_obj & (~1));
29865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29867 Init_free(this_obj_conv);
29870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29871 LDKInit this_ptr_conv;
29872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29873 this_ptr_conv.is_owned = false;
29874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29875 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
29876 int64_t ret_ref = 0;
29877 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29878 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29880 ret_ref = (uintptr_t)ret_var.inner;
29881 if (ret_var.is_owned) {
29887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29888 LDKInit this_ptr_conv;
29889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29890 this_ptr_conv.is_owned = false;
29891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29892 LDKInitFeatures val_conv;
29893 val_conv.inner = (void*)(val & (~1));
29894 val_conv.is_owned = (val & 1) || (val == 0);
29895 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29896 val_conv = InitFeatures_clone(&val_conv);
29897 Init_set_features(&this_ptr_conv, val_conv);
29900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
29901 LDKInit this_ptr_conv;
29902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29903 this_ptr_conv.is_owned = false;
29904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29905 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
29906 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
29907 int64_t ret_ref = (uintptr_t)ret_copy;
29911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29912 LDKInit this_ptr_conv;
29913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29914 this_ptr_conv.is_owned = false;
29915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29916 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29917 CHECK_ACCESS(val_ptr);
29918 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
29919 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
29920 Init_set_remote_network_address(&this_ptr_conv, val_conv);
29923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t remote_network_address_arg) {
29924 LDKInitFeatures features_arg_conv;
29925 features_arg_conv.inner = (void*)(features_arg & (~1));
29926 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
29927 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29928 features_arg_conv = InitFeatures_clone(&features_arg_conv);
29929 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
29930 CHECK_ACCESS(remote_network_address_arg_ptr);
29931 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
29932 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
29933 int64_t ret_ref = 0;
29934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29937 ret_ref = (uintptr_t)ret_var.inner;
29938 if (ret_var.is_owned) {
29944 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
29945 LDKInit ret_var = Init_clone(arg);
29946 int64_t ret_ref = 0;
29947 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29948 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29950 ret_ref = (uintptr_t)ret_var.inner;
29951 if (ret_var.is_owned) {
29956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29958 arg_conv.inner = (void*)(arg & (~1));
29959 arg_conv.is_owned = false;
29960 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29961 int64_t ret_val = Init_clone_ptr(&arg_conv);
29965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29967 orig_conv.inner = (void*)(orig & (~1));
29968 orig_conv.is_owned = false;
29969 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29970 LDKInit ret_var = Init_clone(&orig_conv);
29971 int64_t ret_ref = 0;
29972 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29973 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29975 ret_ref = (uintptr_t)ret_var.inner;
29976 if (ret_var.is_owned) {
29982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29983 LDKErrorMessage this_obj_conv;
29984 this_obj_conv.inner = (void*)(this_obj & (~1));
29985 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29987 ErrorMessage_free(this_obj_conv);
29990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29991 LDKErrorMessage this_ptr_conv;
29992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29993 this_ptr_conv.is_owned = false;
29994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29995 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29996 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
30000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30001 LDKErrorMessage this_ptr_conv;
30002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30003 this_ptr_conv.is_owned = false;
30004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30005 LDKThirtyTwoBytes val_ref;
30006 CHECK((*env)->GetArrayLength(env, val) == 32);
30007 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30008 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30011 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30012 LDKErrorMessage 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 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30017 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30023 LDKErrorMessage this_ptr_conv;
30024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30025 this_ptr_conv.is_owned = false;
30026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30027 LDKStr val_conv = java_to_owned_str(env, val);
30028 ErrorMessage_set_data(&this_ptr_conv, val_conv);
30031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30032 LDKThirtyTwoBytes channel_id_arg_ref;
30033 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30034 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30035 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30036 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30037 int64_t ret_ref = 0;
30038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30041 ret_ref = (uintptr_t)ret_var.inner;
30042 if (ret_var.is_owned) {
30048 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30049 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30050 int64_t ret_ref = 0;
30051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30054 ret_ref = (uintptr_t)ret_var.inner;
30055 if (ret_var.is_owned) {
30060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30061 LDKErrorMessage arg_conv;
30062 arg_conv.inner = (void*)(arg & (~1));
30063 arg_conv.is_owned = false;
30064 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30065 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
30069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30070 LDKErrorMessage orig_conv;
30071 orig_conv.inner = (void*)(orig & (~1));
30072 orig_conv.is_owned = false;
30073 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30074 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30075 int64_t ret_ref = 0;
30076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30079 ret_ref = (uintptr_t)ret_var.inner;
30080 if (ret_var.is_owned) {
30086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30087 LDKWarningMessage this_obj_conv;
30088 this_obj_conv.inner = (void*)(this_obj & (~1));
30089 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30091 WarningMessage_free(this_obj_conv);
30094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30095 LDKWarningMessage this_ptr_conv;
30096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30097 this_ptr_conv.is_owned = false;
30098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30099 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30100 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
30104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30105 LDKWarningMessage this_ptr_conv;
30106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30107 this_ptr_conv.is_owned = false;
30108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30109 LDKThirtyTwoBytes val_ref;
30110 CHECK((*env)->GetArrayLength(env, val) == 32);
30111 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30112 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30115 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30116 LDKWarningMessage this_ptr_conv;
30117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30118 this_ptr_conv.is_owned = false;
30119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30120 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30121 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30127 LDKWarningMessage this_ptr_conv;
30128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30129 this_ptr_conv.is_owned = false;
30130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30131 LDKStr val_conv = java_to_owned_str(env, val);
30132 WarningMessage_set_data(&this_ptr_conv, val_conv);
30135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30136 LDKThirtyTwoBytes channel_id_arg_ref;
30137 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30138 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30139 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30140 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30141 int64_t ret_ref = 0;
30142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30145 ret_ref = (uintptr_t)ret_var.inner;
30146 if (ret_var.is_owned) {
30152 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30153 LDKWarningMessage ret_var = WarningMessage_clone(arg);
30154 int64_t ret_ref = 0;
30155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30158 ret_ref = (uintptr_t)ret_var.inner;
30159 if (ret_var.is_owned) {
30164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30165 LDKWarningMessage arg_conv;
30166 arg_conv.inner = (void*)(arg & (~1));
30167 arg_conv.is_owned = false;
30168 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30169 int64_t ret_val = WarningMessage_clone_ptr(&arg_conv);
30173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30174 LDKWarningMessage orig_conv;
30175 orig_conv.inner = (void*)(orig & (~1));
30176 orig_conv.is_owned = false;
30177 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30178 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30179 int64_t ret_ref = 0;
30180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30183 ret_ref = (uintptr_t)ret_var.inner;
30184 if (ret_var.is_owned) {
30190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30191 LDKPing this_obj_conv;
30192 this_obj_conv.inner = (void*)(this_obj & (~1));
30193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30195 Ping_free(this_obj_conv);
30198 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30199 LDKPing this_ptr_conv;
30200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30201 this_ptr_conv.is_owned = false;
30202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30203 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
30207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30208 LDKPing this_ptr_conv;
30209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30210 this_ptr_conv.is_owned = false;
30211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30212 Ping_set_ponglen(&this_ptr_conv, val);
30215 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30216 LDKPing this_ptr_conv;
30217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30218 this_ptr_conv.is_owned = false;
30219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30220 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
30224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30225 LDKPing this_ptr_conv;
30226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30227 this_ptr_conv.is_owned = false;
30228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30229 Ping_set_byteslen(&this_ptr_conv, val);
30232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
30233 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30234 int64_t ret_ref = 0;
30235 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30236 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30238 ret_ref = (uintptr_t)ret_var.inner;
30239 if (ret_var.is_owned) {
30245 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30246 LDKPing ret_var = Ping_clone(arg);
30247 int64_t ret_ref = 0;
30248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30251 ret_ref = (uintptr_t)ret_var.inner;
30252 if (ret_var.is_owned) {
30257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30259 arg_conv.inner = (void*)(arg & (~1));
30260 arg_conv.is_owned = false;
30261 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30262 int64_t ret_val = Ping_clone_ptr(&arg_conv);
30266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30268 orig_conv.inner = (void*)(orig & (~1));
30269 orig_conv.is_owned = false;
30270 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30271 LDKPing ret_var = Ping_clone(&orig_conv);
30272 int64_t ret_ref = 0;
30273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30276 ret_ref = (uintptr_t)ret_var.inner;
30277 if (ret_var.is_owned) {
30283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30284 LDKPong this_obj_conv;
30285 this_obj_conv.inner = (void*)(this_obj & (~1));
30286 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30288 Pong_free(this_obj_conv);
30291 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30292 LDKPong this_ptr_conv;
30293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30294 this_ptr_conv.is_owned = false;
30295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30296 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
30300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30301 LDKPong this_ptr_conv;
30302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30303 this_ptr_conv.is_owned = false;
30304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30305 Pong_set_byteslen(&this_ptr_conv, val);
30308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
30309 LDKPong ret_var = Pong_new(byteslen_arg);
30310 int64_t ret_ref = 0;
30311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30314 ret_ref = (uintptr_t)ret_var.inner;
30315 if (ret_var.is_owned) {
30321 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30322 LDKPong ret_var = Pong_clone(arg);
30323 int64_t ret_ref = 0;
30324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30327 ret_ref = (uintptr_t)ret_var.inner;
30328 if (ret_var.is_owned) {
30333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30335 arg_conv.inner = (void*)(arg & (~1));
30336 arg_conv.is_owned = false;
30337 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30338 int64_t ret_val = Pong_clone_ptr(&arg_conv);
30342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30344 orig_conv.inner = (void*)(orig & (~1));
30345 orig_conv.is_owned = false;
30346 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30347 LDKPong ret_var = Pong_clone(&orig_conv);
30348 int64_t ret_ref = 0;
30349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30352 ret_ref = (uintptr_t)ret_var.inner;
30353 if (ret_var.is_owned) {
30359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30360 LDKOpenChannel this_obj_conv;
30361 this_obj_conv.inner = (void*)(this_obj & (~1));
30362 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30364 OpenChannel_free(this_obj_conv);
30367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30368 LDKOpenChannel this_ptr_conv;
30369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30370 this_ptr_conv.is_owned = false;
30371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30372 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30373 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
30377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30378 LDKOpenChannel this_ptr_conv;
30379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30380 this_ptr_conv.is_owned = false;
30381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30382 LDKThirtyTwoBytes val_ref;
30383 CHECK((*env)->GetArrayLength(env, val) == 32);
30384 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30385 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30389 LDKOpenChannel this_ptr_conv;
30390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30391 this_ptr_conv.is_owned = false;
30392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30393 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30394 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
30398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30399 LDKOpenChannel this_ptr_conv;
30400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30401 this_ptr_conv.is_owned = false;
30402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30403 LDKThirtyTwoBytes val_ref;
30404 CHECK((*env)->GetArrayLength(env, val) == 32);
30405 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30406 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30410 LDKOpenChannel this_ptr_conv;
30411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30412 this_ptr_conv.is_owned = false;
30413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30414 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30419 LDKOpenChannel this_ptr_conv;
30420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30421 this_ptr_conv.is_owned = false;
30422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30423 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30427 LDKOpenChannel this_ptr_conv;
30428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30429 this_ptr_conv.is_owned = false;
30430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30431 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
30435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30436 LDKOpenChannel this_ptr_conv;
30437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30438 this_ptr_conv.is_owned = false;
30439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30440 OpenChannel_set_push_msat(&this_ptr_conv, val);
30443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30444 LDKOpenChannel this_ptr_conv;
30445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30446 this_ptr_conv.is_owned = false;
30447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30448 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30453 LDKOpenChannel this_ptr_conv;
30454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30455 this_ptr_conv.is_owned = false;
30456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30457 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30460 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) {
30461 LDKOpenChannel this_ptr_conv;
30462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30463 this_ptr_conv.is_owned = false;
30464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30465 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30469 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) {
30470 LDKOpenChannel 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 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30478 LDKOpenChannel this_ptr_conv;
30479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30480 this_ptr_conv.is_owned = false;
30481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30482 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30487 LDKOpenChannel this_ptr_conv;
30488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30489 this_ptr_conv.is_owned = false;
30490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30491 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30495 LDKOpenChannel this_ptr_conv;
30496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30497 this_ptr_conv.is_owned = false;
30498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30499 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30504 LDKOpenChannel this_ptr_conv;
30505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30506 this_ptr_conv.is_owned = false;
30507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30508 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30511 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
30512 LDKOpenChannel 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 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30521 LDKOpenChannel this_ptr_conv;
30522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30523 this_ptr_conv.is_owned = false;
30524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30525 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30528 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30529 LDKOpenChannel this_ptr_conv;
30530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30531 this_ptr_conv.is_owned = false;
30532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30533 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
30537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30538 LDKOpenChannel this_ptr_conv;
30539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30540 this_ptr_conv.is_owned = false;
30541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30542 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30545 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
30546 LDKOpenChannel this_ptr_conv;
30547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30548 this_ptr_conv.is_owned = false;
30549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30550 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30555 LDKOpenChannel this_ptr_conv;
30556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30557 this_ptr_conv.is_owned = false;
30558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30559 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30563 LDKOpenChannel this_ptr_conv;
30564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30565 this_ptr_conv.is_owned = false;
30566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30567 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30568 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
30572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30573 LDKOpenChannel this_ptr_conv;
30574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30575 this_ptr_conv.is_owned = false;
30576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30577 LDKPublicKey val_ref;
30578 CHECK((*env)->GetArrayLength(env, val) == 33);
30579 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30580 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30584 LDKOpenChannel this_ptr_conv;
30585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30586 this_ptr_conv.is_owned = false;
30587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30588 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
30593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30594 LDKOpenChannel 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 LDKPublicKey val_ref;
30599 CHECK((*env)->GetArrayLength(env, val) == 33);
30600 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30601 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30605 LDKOpenChannel this_ptr_conv;
30606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30607 this_ptr_conv.is_owned = false;
30608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30609 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30610 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
30614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30615 LDKOpenChannel this_ptr_conv;
30616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30617 this_ptr_conv.is_owned = false;
30618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30619 LDKPublicKey val_ref;
30620 CHECK((*env)->GetArrayLength(env, val) == 33);
30621 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30622 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
30625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30626 LDKOpenChannel this_ptr_conv;
30627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30628 this_ptr_conv.is_owned = false;
30629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30630 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30631 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
30635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30636 LDKOpenChannel this_ptr_conv;
30637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30638 this_ptr_conv.is_owned = false;
30639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30640 LDKPublicKey val_ref;
30641 CHECK((*env)->GetArrayLength(env, val) == 33);
30642 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30643 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30647 LDKOpenChannel this_ptr_conv;
30648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30649 this_ptr_conv.is_owned = false;
30650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30651 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30652 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
30656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30657 LDKOpenChannel this_ptr_conv;
30658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30659 this_ptr_conv.is_owned = false;
30660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30661 LDKPublicKey val_ref;
30662 CHECK((*env)->GetArrayLength(env, val) == 33);
30663 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30664 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30668 LDKOpenChannel this_ptr_conv;
30669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30670 this_ptr_conv.is_owned = false;
30671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30672 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30673 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
30677 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) {
30678 LDKOpenChannel this_ptr_conv;
30679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30680 this_ptr_conv.is_owned = false;
30681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30682 LDKPublicKey val_ref;
30683 CHECK((*env)->GetArrayLength(env, val) == 33);
30684 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30685 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30688 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
30689 LDKOpenChannel this_ptr_conv;
30690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30691 this_ptr_conv.is_owned = false;
30692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30693 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
30697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
30698 LDKOpenChannel this_ptr_conv;
30699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30700 this_ptr_conv.is_owned = false;
30701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30702 OpenChannel_set_channel_flags(&this_ptr_conv, val);
30705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
30706 LDKOpenChannel this_ptr_conv;
30707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30708 this_ptr_conv.is_owned = false;
30709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30710 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
30711 int64_t ret_ref = 0;
30712 if ((uintptr_t)ret_var.inner > 4096) {
30713 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30714 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30716 ret_ref = (uintptr_t)ret_var.inner;
30717 if (ret_var.is_owned) {
30724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30725 LDKOpenChannel this_ptr_conv;
30726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30727 this_ptr_conv.is_owned = false;
30728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30729 LDKChannelTypeFeatures val_conv;
30730 val_conv.inner = (void*)(val & (~1));
30731 val_conv.is_owned = (val & 1) || (val == 0);
30732 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30733 val_conv = ChannelTypeFeatures_clone(&val_conv);
30734 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
30737 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
30738 LDKOpenChannel ret_var = OpenChannel_clone(arg);
30739 int64_t ret_ref = 0;
30740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30743 ret_ref = (uintptr_t)ret_var.inner;
30744 if (ret_var.is_owned) {
30749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30750 LDKOpenChannel arg_conv;
30751 arg_conv.inner = (void*)(arg & (~1));
30752 arg_conv.is_owned = false;
30753 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30754 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
30758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30759 LDKOpenChannel orig_conv;
30760 orig_conv.inner = (void*)(orig & (~1));
30761 orig_conv.is_owned = false;
30762 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30763 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
30764 int64_t ret_ref = 0;
30765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30768 ret_ref = (uintptr_t)ret_var.inner;
30769 if (ret_var.is_owned) {
30775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30776 LDKAcceptChannel this_obj_conv;
30777 this_obj_conv.inner = (void*)(this_obj & (~1));
30778 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30780 AcceptChannel_free(this_obj_conv);
30783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30784 LDKAcceptChannel this_ptr_conv;
30785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30786 this_ptr_conv.is_owned = false;
30787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30788 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30789 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
30793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30794 LDKAcceptChannel this_ptr_conv;
30795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30796 this_ptr_conv.is_owned = false;
30797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30798 LDKThirtyTwoBytes val_ref;
30799 CHECK((*env)->GetArrayLength(env, val) == 32);
30800 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30801 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30805 LDKAcceptChannel this_ptr_conv;
30806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30807 this_ptr_conv.is_owned = false;
30808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30809 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
30813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30814 LDKAcceptChannel this_ptr_conv;
30815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30816 this_ptr_conv.is_owned = false;
30817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30818 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30821 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) {
30822 LDKAcceptChannel 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 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30830 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) {
30831 LDKAcceptChannel this_ptr_conv;
30832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30833 this_ptr_conv.is_owned = false;
30834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30835 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30839 LDKAcceptChannel this_ptr_conv;
30840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30841 this_ptr_conv.is_owned = false;
30842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30843 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30848 LDKAcceptChannel this_ptr_conv;
30849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30850 this_ptr_conv.is_owned = false;
30851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30852 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30856 LDKAcceptChannel this_ptr_conv;
30857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30858 this_ptr_conv.is_owned = false;
30859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30860 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
30864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30865 LDKAcceptChannel this_ptr_conv;
30866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30867 this_ptr_conv.is_owned = false;
30868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30869 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30872 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
30873 LDKAcceptChannel this_ptr_conv;
30874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30875 this_ptr_conv.is_owned = false;
30876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30877 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
30881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30882 LDKAcceptChannel this_ptr_conv;
30883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30884 this_ptr_conv.is_owned = false;
30885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30886 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
30889 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30890 LDKAcceptChannel this_ptr_conv;
30891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30892 this_ptr_conv.is_owned = false;
30893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30894 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
30898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30899 LDKAcceptChannel this_ptr_conv;
30900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30901 this_ptr_conv.is_owned = false;
30902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30903 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
30906 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
30907 LDKAcceptChannel this_ptr_conv;
30908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30909 this_ptr_conv.is_owned = false;
30910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30911 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
30915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30916 LDKAcceptChannel this_ptr_conv;
30917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30918 this_ptr_conv.is_owned = false;
30919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30920 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30924 LDKAcceptChannel this_ptr_conv;
30925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30926 this_ptr_conv.is_owned = false;
30927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30928 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30929 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
30933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30934 LDKAcceptChannel this_ptr_conv;
30935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30936 this_ptr_conv.is_owned = false;
30937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30938 LDKPublicKey val_ref;
30939 CHECK((*env)->GetArrayLength(env, val) == 33);
30940 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30941 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30945 LDKAcceptChannel this_ptr_conv;
30946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30947 this_ptr_conv.is_owned = false;
30948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30949 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
30954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30955 LDKAcceptChannel this_ptr_conv;
30956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30957 this_ptr_conv.is_owned = false;
30958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30959 LDKPublicKey val_ref;
30960 CHECK((*env)->GetArrayLength(env, val) == 33);
30961 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30962 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30966 LDKAcceptChannel this_ptr_conv;
30967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30968 this_ptr_conv.is_owned = false;
30969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30970 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30971 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
30975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30976 LDKAcceptChannel this_ptr_conv;
30977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30978 this_ptr_conv.is_owned = false;
30979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30980 LDKPublicKey val_ref;
30981 CHECK((*env)->GetArrayLength(env, val) == 33);
30982 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30983 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
30986 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30987 LDKAcceptChannel this_ptr_conv;
30988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30989 this_ptr_conv.is_owned = false;
30990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30991 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30992 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
30996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30997 LDKAcceptChannel this_ptr_conv;
30998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30999 this_ptr_conv.is_owned = false;
31000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31001 LDKPublicKey val_ref;
31002 CHECK((*env)->GetArrayLength(env, val) == 33);
31003 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31004 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31008 LDKAcceptChannel this_ptr_conv;
31009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31010 this_ptr_conv.is_owned = false;
31011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31012 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31013 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31018 LDKAcceptChannel this_ptr_conv;
31019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31020 this_ptr_conv.is_owned = false;
31021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31022 LDKPublicKey val_ref;
31023 CHECK((*env)->GetArrayLength(env, val) == 33);
31024 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31025 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31029 LDKAcceptChannel this_ptr_conv;
31030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31031 this_ptr_conv.is_owned = false;
31032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31033 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31034 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31038 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) {
31039 LDKAcceptChannel this_ptr_conv;
31040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31041 this_ptr_conv.is_owned = false;
31042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31043 LDKPublicKey val_ref;
31044 CHECK((*env)->GetArrayLength(env, val) == 33);
31045 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31046 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31050 LDKAcceptChannel this_ptr_conv;
31051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31052 this_ptr_conv.is_owned = false;
31053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31054 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31055 int64_t ret_ref = 0;
31056 if ((uintptr_t)ret_var.inner > 4096) {
31057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31060 ret_ref = (uintptr_t)ret_var.inner;
31061 if (ret_var.is_owned) {
31068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31069 LDKAcceptChannel this_ptr_conv;
31070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31071 this_ptr_conv.is_owned = false;
31072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31073 LDKChannelTypeFeatures val_conv;
31074 val_conv.inner = (void*)(val & (~1));
31075 val_conv.is_owned = (val & 1) || (val == 0);
31076 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31077 val_conv = ChannelTypeFeatures_clone(&val_conv);
31078 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31081 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31082 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31083 int64_t ret_ref = 0;
31084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31087 ret_ref = (uintptr_t)ret_var.inner;
31088 if (ret_var.is_owned) {
31093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31094 LDKAcceptChannel arg_conv;
31095 arg_conv.inner = (void*)(arg & (~1));
31096 arg_conv.is_owned = false;
31097 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31098 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
31102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31103 LDKAcceptChannel orig_conv;
31104 orig_conv.inner = (void*)(orig & (~1));
31105 orig_conv.is_owned = false;
31106 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31107 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31108 int64_t ret_ref = 0;
31109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31112 ret_ref = (uintptr_t)ret_var.inner;
31113 if (ret_var.is_owned) {
31119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31120 LDKFundingCreated this_obj_conv;
31121 this_obj_conv.inner = (void*)(this_obj & (~1));
31122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31124 FundingCreated_free(this_obj_conv);
31127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31128 LDKFundingCreated this_ptr_conv;
31129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31130 this_ptr_conv.is_owned = false;
31131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31132 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31133 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
31137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31138 LDKFundingCreated this_ptr_conv;
31139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31140 this_ptr_conv.is_owned = false;
31141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31142 LDKThirtyTwoBytes val_ref;
31143 CHECK((*env)->GetArrayLength(env, val) == 32);
31144 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31145 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
31149 LDKFundingCreated this_ptr_conv;
31150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31151 this_ptr_conv.is_owned = false;
31152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31153 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31154 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
31158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31159 LDKFundingCreated this_ptr_conv;
31160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31161 this_ptr_conv.is_owned = false;
31162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31163 LDKThirtyTwoBytes val_ref;
31164 CHECK((*env)->GetArrayLength(env, val) == 32);
31165 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31166 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31169 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
31170 LDKFundingCreated this_ptr_conv;
31171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31172 this_ptr_conv.is_owned = false;
31173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31174 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
31178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31179 LDKFundingCreated this_ptr_conv;
31180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31181 this_ptr_conv.is_owned = false;
31182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31183 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31187 LDKFundingCreated this_ptr_conv;
31188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31189 this_ptr_conv.is_owned = false;
31190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31191 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31192 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
31196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31197 LDKFundingCreated this_ptr_conv;
31198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31199 this_ptr_conv.is_owned = false;
31200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31201 LDKSignature val_ref;
31202 CHECK((*env)->GetArrayLength(env, val) == 64);
31203 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31204 FundingCreated_set_signature(&this_ptr_conv, val_ref);
31207 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) {
31208 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31209 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
31210 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
31211 LDKThirtyTwoBytes funding_txid_arg_ref;
31212 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
31213 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
31214 LDKSignature signature_arg_ref;
31215 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31216 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31217 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31218 int64_t ret_ref = 0;
31219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31222 ret_ref = (uintptr_t)ret_var.inner;
31223 if (ret_var.is_owned) {
31229 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31230 LDKFundingCreated ret_var = FundingCreated_clone(arg);
31231 int64_t ret_ref = 0;
31232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31235 ret_ref = (uintptr_t)ret_var.inner;
31236 if (ret_var.is_owned) {
31241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31242 LDKFundingCreated arg_conv;
31243 arg_conv.inner = (void*)(arg & (~1));
31244 arg_conv.is_owned = false;
31245 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31246 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
31250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31251 LDKFundingCreated orig_conv;
31252 orig_conv.inner = (void*)(orig & (~1));
31253 orig_conv.is_owned = false;
31254 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31255 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31256 int64_t ret_ref = 0;
31257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31260 ret_ref = (uintptr_t)ret_var.inner;
31261 if (ret_var.is_owned) {
31267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31268 LDKFundingSigned this_obj_conv;
31269 this_obj_conv.inner = (void*)(this_obj & (~1));
31270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31272 FundingSigned_free(this_obj_conv);
31275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31276 LDKFundingSigned this_ptr_conv;
31277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31278 this_ptr_conv.is_owned = false;
31279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31280 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31281 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
31285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31286 LDKFundingSigned this_ptr_conv;
31287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31288 this_ptr_conv.is_owned = false;
31289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31290 LDKThirtyTwoBytes val_ref;
31291 CHECK((*env)->GetArrayLength(env, val) == 32);
31292 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31293 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31297 LDKFundingSigned this_ptr_conv;
31298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31299 this_ptr_conv.is_owned = false;
31300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31301 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31302 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
31306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31307 LDKFundingSigned this_ptr_conv;
31308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31309 this_ptr_conv.is_owned = false;
31310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31311 LDKSignature val_ref;
31312 CHECK((*env)->GetArrayLength(env, val) == 64);
31313 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31314 FundingSigned_set_signature(&this_ptr_conv, val_ref);
31317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
31318 LDKThirtyTwoBytes channel_id_arg_ref;
31319 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31320 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31321 LDKSignature signature_arg_ref;
31322 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31323 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31324 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31325 int64_t ret_ref = 0;
31326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31329 ret_ref = (uintptr_t)ret_var.inner;
31330 if (ret_var.is_owned) {
31336 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31337 LDKFundingSigned ret_var = FundingSigned_clone(arg);
31338 int64_t ret_ref = 0;
31339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31342 ret_ref = (uintptr_t)ret_var.inner;
31343 if (ret_var.is_owned) {
31348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31349 LDKFundingSigned arg_conv;
31350 arg_conv.inner = (void*)(arg & (~1));
31351 arg_conv.is_owned = false;
31352 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31353 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
31357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31358 LDKFundingSigned orig_conv;
31359 orig_conv.inner = (void*)(orig & (~1));
31360 orig_conv.is_owned = false;
31361 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31362 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31363 int64_t ret_ref = 0;
31364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31367 ret_ref = (uintptr_t)ret_var.inner;
31368 if (ret_var.is_owned) {
31374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31375 LDKFundingLocked this_obj_conv;
31376 this_obj_conv.inner = (void*)(this_obj & (~1));
31377 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31379 FundingLocked_free(this_obj_conv);
31382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31383 LDKFundingLocked this_ptr_conv;
31384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31385 this_ptr_conv.is_owned = false;
31386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31387 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31388 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
31392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31393 LDKFundingLocked this_ptr_conv;
31394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31395 this_ptr_conv.is_owned = false;
31396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31397 LDKThirtyTwoBytes val_ref;
31398 CHECK((*env)->GetArrayLength(env, val) == 32);
31399 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31400 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
31403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31404 LDKFundingLocked this_ptr_conv;
31405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31406 this_ptr_conv.is_owned = false;
31407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31408 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31409 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
31413 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) {
31414 LDKFundingLocked this_ptr_conv;
31415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31416 this_ptr_conv.is_owned = false;
31417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31418 LDKPublicKey val_ref;
31419 CHECK((*env)->GetArrayLength(env, val) == 33);
31420 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31421 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
31425 LDKFundingLocked this_ptr_conv;
31426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31427 this_ptr_conv.is_owned = false;
31428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31429 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31430 *ret_copy = FundingLocked_get_short_channel_id_alias(&this_ptr_conv);
31431 int64_t ret_ref = (uintptr_t)ret_copy;
31435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31436 LDKFundingLocked this_ptr_conv;
31437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31438 this_ptr_conv.is_owned = false;
31439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31440 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31441 CHECK_ACCESS(val_ptr);
31442 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31443 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
31444 FundingLocked_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
31448 LDKThirtyTwoBytes channel_id_arg_ref;
31449 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31450 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31451 LDKPublicKey next_per_commitment_point_arg_ref;
31452 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
31453 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
31454 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
31455 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31456 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31457 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
31458 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31459 int64_t ret_ref = 0;
31460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31463 ret_ref = (uintptr_t)ret_var.inner;
31464 if (ret_var.is_owned) {
31470 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
31471 LDKFundingLocked ret_var = FundingLocked_clone(arg);
31472 int64_t ret_ref = 0;
31473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31476 ret_ref = (uintptr_t)ret_var.inner;
31477 if (ret_var.is_owned) {
31482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31483 LDKFundingLocked arg_conv;
31484 arg_conv.inner = (void*)(arg & (~1));
31485 arg_conv.is_owned = false;
31486 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31487 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
31491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31492 LDKFundingLocked orig_conv;
31493 orig_conv.inner = (void*)(orig & (~1));
31494 orig_conv.is_owned = false;
31495 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31496 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
31497 int64_t ret_ref = 0;
31498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31501 ret_ref = (uintptr_t)ret_var.inner;
31502 if (ret_var.is_owned) {
31508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31509 LDKShutdown this_obj_conv;
31510 this_obj_conv.inner = (void*)(this_obj & (~1));
31511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31513 Shutdown_free(this_obj_conv);
31516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31517 LDKShutdown this_ptr_conv;
31518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31519 this_ptr_conv.is_owned = false;
31520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31521 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31522 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
31526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31527 LDKShutdown this_ptr_conv;
31528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31529 this_ptr_conv.is_owned = false;
31530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31531 LDKThirtyTwoBytes val_ref;
31532 CHECK((*env)->GetArrayLength(env, val) == 32);
31533 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31534 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
31537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31538 LDKShutdown this_ptr_conv;
31539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31540 this_ptr_conv.is_owned = false;
31541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31542 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
31543 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31544 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31549 LDKShutdown this_ptr_conv;
31550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31551 this_ptr_conv.is_owned = false;
31552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31553 LDKCVec_u8Z val_ref;
31554 val_ref.datalen = (*env)->GetArrayLength(env, val);
31555 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31556 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
31557 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
31560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
31561 LDKThirtyTwoBytes channel_id_arg_ref;
31562 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31563 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31564 LDKCVec_u8Z scriptpubkey_arg_ref;
31565 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
31566 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31567 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
31568 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
31569 int64_t ret_ref = 0;
31570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31573 ret_ref = (uintptr_t)ret_var.inner;
31574 if (ret_var.is_owned) {
31580 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
31581 LDKShutdown ret_var = Shutdown_clone(arg);
31582 int64_t ret_ref = 0;
31583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31586 ret_ref = (uintptr_t)ret_var.inner;
31587 if (ret_var.is_owned) {
31592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31593 LDKShutdown arg_conv;
31594 arg_conv.inner = (void*)(arg & (~1));
31595 arg_conv.is_owned = false;
31596 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31597 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
31601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31602 LDKShutdown orig_conv;
31603 orig_conv.inner = (void*)(orig & (~1));
31604 orig_conv.is_owned = false;
31605 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31606 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
31607 int64_t ret_ref = 0;
31608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31611 ret_ref = (uintptr_t)ret_var.inner;
31612 if (ret_var.is_owned) {
31618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31619 LDKClosingSignedFeeRange this_obj_conv;
31620 this_obj_conv.inner = (void*)(this_obj & (~1));
31621 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31623 ClosingSignedFeeRange_free(this_obj_conv);
31626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31627 LDKClosingSignedFeeRange this_ptr_conv;
31628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31629 this_ptr_conv.is_owned = false;
31630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31631 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
31635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31636 LDKClosingSignedFeeRange this_ptr_conv;
31637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31638 this_ptr_conv.is_owned = false;
31639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31640 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
31643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31644 LDKClosingSignedFeeRange this_ptr_conv;
31645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31646 this_ptr_conv.is_owned = false;
31647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31648 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
31652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31653 LDKClosingSignedFeeRange this_ptr_conv;
31654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31655 this_ptr_conv.is_owned = false;
31656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31657 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
31660 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) {
31661 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
31662 int64_t ret_ref = 0;
31663 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31664 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31666 ret_ref = (uintptr_t)ret_var.inner;
31667 if (ret_var.is_owned) {
31673 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
31674 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
31675 int64_t ret_ref = 0;
31676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31679 ret_ref = (uintptr_t)ret_var.inner;
31680 if (ret_var.is_owned) {
31685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31686 LDKClosingSignedFeeRange arg_conv;
31687 arg_conv.inner = (void*)(arg & (~1));
31688 arg_conv.is_owned = false;
31689 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31690 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
31694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31695 LDKClosingSignedFeeRange orig_conv;
31696 orig_conv.inner = (void*)(orig & (~1));
31697 orig_conv.is_owned = false;
31698 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31699 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
31700 int64_t ret_ref = 0;
31701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31704 ret_ref = (uintptr_t)ret_var.inner;
31705 if (ret_var.is_owned) {
31711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31712 LDKClosingSigned this_obj_conv;
31713 this_obj_conv.inner = (void*)(this_obj & (~1));
31714 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31716 ClosingSigned_free(this_obj_conv);
31719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31720 LDKClosingSigned this_ptr_conv;
31721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31722 this_ptr_conv.is_owned = false;
31723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31724 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31725 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
31729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31730 LDKClosingSigned this_ptr_conv;
31731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31732 this_ptr_conv.is_owned = false;
31733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31734 LDKThirtyTwoBytes val_ref;
31735 CHECK((*env)->GetArrayLength(env, val) == 32);
31736 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31737 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
31740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31741 LDKClosingSigned this_ptr_conv;
31742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31743 this_ptr_conv.is_owned = false;
31744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31745 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
31749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31750 LDKClosingSigned this_ptr_conv;
31751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31752 this_ptr_conv.is_owned = false;
31753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31754 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
31757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31758 LDKClosingSigned this_ptr_conv;
31759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31760 this_ptr_conv.is_owned = false;
31761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31762 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31763 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
31767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31768 LDKClosingSigned this_ptr_conv;
31769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31770 this_ptr_conv.is_owned = false;
31771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31772 LDKSignature val_ref;
31773 CHECK((*env)->GetArrayLength(env, val) == 64);
31774 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31775 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
31778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
31779 LDKClosingSigned this_ptr_conv;
31780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31781 this_ptr_conv.is_owned = false;
31782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31783 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
31784 int64_t ret_ref = 0;
31785 if ((uintptr_t)ret_var.inner > 4096) {
31786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31789 ret_ref = (uintptr_t)ret_var.inner;
31790 if (ret_var.is_owned) {
31797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31798 LDKClosingSigned this_ptr_conv;
31799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31800 this_ptr_conv.is_owned = false;
31801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31802 LDKClosingSignedFeeRange val_conv;
31803 val_conv.inner = (void*)(val & (~1));
31804 val_conv.is_owned = (val & 1) || (val == 0);
31805 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31806 val_conv = ClosingSignedFeeRange_clone(&val_conv);
31807 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
31810 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) {
31811 LDKThirtyTwoBytes channel_id_arg_ref;
31812 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31813 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31814 LDKSignature signature_arg_ref;
31815 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31816 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31817 LDKClosingSignedFeeRange fee_range_arg_conv;
31818 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
31819 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
31820 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
31821 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
31822 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
31823 int64_t ret_ref = 0;
31824 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31825 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31827 ret_ref = (uintptr_t)ret_var.inner;
31828 if (ret_var.is_owned) {
31834 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
31835 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
31836 int64_t ret_ref = 0;
31837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31840 ret_ref = (uintptr_t)ret_var.inner;
31841 if (ret_var.is_owned) {
31846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31847 LDKClosingSigned arg_conv;
31848 arg_conv.inner = (void*)(arg & (~1));
31849 arg_conv.is_owned = false;
31850 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31851 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
31855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31856 LDKClosingSigned orig_conv;
31857 orig_conv.inner = (void*)(orig & (~1));
31858 orig_conv.is_owned = false;
31859 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31860 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
31861 int64_t ret_ref = 0;
31862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31865 ret_ref = (uintptr_t)ret_var.inner;
31866 if (ret_var.is_owned) {
31872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31873 LDKUpdateAddHTLC this_obj_conv;
31874 this_obj_conv.inner = (void*)(this_obj & (~1));
31875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31877 UpdateAddHTLC_free(this_obj_conv);
31880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31881 LDKUpdateAddHTLC this_ptr_conv;
31882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31883 this_ptr_conv.is_owned = false;
31884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31885 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31886 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
31890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31891 LDKUpdateAddHTLC this_ptr_conv;
31892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31893 this_ptr_conv.is_owned = false;
31894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31895 LDKThirtyTwoBytes val_ref;
31896 CHECK((*env)->GetArrayLength(env, val) == 32);
31897 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31898 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
31901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31902 LDKUpdateAddHTLC this_ptr_conv;
31903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31904 this_ptr_conv.is_owned = false;
31905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31906 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
31910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31911 LDKUpdateAddHTLC this_ptr_conv;
31912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31913 this_ptr_conv.is_owned = false;
31914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31915 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
31918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31919 LDKUpdateAddHTLC this_ptr_conv;
31920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31921 this_ptr_conv.is_owned = false;
31922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31923 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
31927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31928 LDKUpdateAddHTLC this_ptr_conv;
31929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31930 this_ptr_conv.is_owned = false;
31931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31932 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
31935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31936 LDKUpdateAddHTLC this_ptr_conv;
31937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31938 this_ptr_conv.is_owned = false;
31939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31940 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31941 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
31945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31946 LDKUpdateAddHTLC this_ptr_conv;
31947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31948 this_ptr_conv.is_owned = false;
31949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31950 LDKThirtyTwoBytes val_ref;
31951 CHECK((*env)->GetArrayLength(env, val) == 32);
31952 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31953 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
31956 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
31957 LDKUpdateAddHTLC this_ptr_conv;
31958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31959 this_ptr_conv.is_owned = false;
31960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31961 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
31965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31966 LDKUpdateAddHTLC this_ptr_conv;
31967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31968 this_ptr_conv.is_owned = false;
31969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31970 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
31973 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
31974 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
31975 int64_t ret_ref = 0;
31976 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31977 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31979 ret_ref = (uintptr_t)ret_var.inner;
31980 if (ret_var.is_owned) {
31985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31986 LDKUpdateAddHTLC arg_conv;
31987 arg_conv.inner = (void*)(arg & (~1));
31988 arg_conv.is_owned = false;
31989 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31990 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
31994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31995 LDKUpdateAddHTLC orig_conv;
31996 orig_conv.inner = (void*)(orig & (~1));
31997 orig_conv.is_owned = false;
31998 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31999 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32000 int64_t ret_ref = 0;
32001 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32002 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32004 ret_ref = (uintptr_t)ret_var.inner;
32005 if (ret_var.is_owned) {
32011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32012 LDKUpdateFulfillHTLC this_obj_conv;
32013 this_obj_conv.inner = (void*)(this_obj & (~1));
32014 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32016 UpdateFulfillHTLC_free(this_obj_conv);
32019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32020 LDKUpdateFulfillHTLC 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32025 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
32029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32030 LDKUpdateFulfillHTLC this_ptr_conv;
32031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32032 this_ptr_conv.is_owned = false;
32033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32034 LDKThirtyTwoBytes val_ref;
32035 CHECK((*env)->GetArrayLength(env, val) == 32);
32036 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32037 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32041 LDKUpdateFulfillHTLC this_ptr_conv;
32042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32043 this_ptr_conv.is_owned = false;
32044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32045 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32050 LDKUpdateFulfillHTLC this_ptr_conv;
32051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32052 this_ptr_conv.is_owned = false;
32053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32054 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
32058 LDKUpdateFulfillHTLC this_ptr_conv;
32059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32060 this_ptr_conv.is_owned = false;
32061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32062 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32063 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
32067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32068 LDKUpdateFulfillHTLC this_ptr_conv;
32069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32070 this_ptr_conv.is_owned = false;
32071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32072 LDKThirtyTwoBytes val_ref;
32073 CHECK((*env)->GetArrayLength(env, val) == 32);
32074 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32075 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32078 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) {
32079 LDKThirtyTwoBytes channel_id_arg_ref;
32080 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32081 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32082 LDKThirtyTwoBytes payment_preimage_arg_ref;
32083 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
32084 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
32085 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32086 int64_t ret_ref = 0;
32087 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32088 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32090 ret_ref = (uintptr_t)ret_var.inner;
32091 if (ret_var.is_owned) {
32097 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32098 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32099 int64_t ret_ref = 0;
32100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32103 ret_ref = (uintptr_t)ret_var.inner;
32104 if (ret_var.is_owned) {
32109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32110 LDKUpdateFulfillHTLC arg_conv;
32111 arg_conv.inner = (void*)(arg & (~1));
32112 arg_conv.is_owned = false;
32113 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32114 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32119 LDKUpdateFulfillHTLC orig_conv;
32120 orig_conv.inner = (void*)(orig & (~1));
32121 orig_conv.is_owned = false;
32122 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32123 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32124 int64_t ret_ref = 0;
32125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32128 ret_ref = (uintptr_t)ret_var.inner;
32129 if (ret_var.is_owned) {
32135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32136 LDKUpdateFailHTLC this_obj_conv;
32137 this_obj_conv.inner = (void*)(this_obj & (~1));
32138 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32140 UpdateFailHTLC_free(this_obj_conv);
32143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32144 LDKUpdateFailHTLC this_ptr_conv;
32145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32146 this_ptr_conv.is_owned = false;
32147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32148 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32149 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
32153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32154 LDKUpdateFailHTLC this_ptr_conv;
32155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32156 this_ptr_conv.is_owned = false;
32157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32158 LDKThirtyTwoBytes val_ref;
32159 CHECK((*env)->GetArrayLength(env, val) == 32);
32160 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32161 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32165 LDKUpdateFailHTLC this_ptr_conv;
32166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32167 this_ptr_conv.is_owned = false;
32168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32169 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32174 LDKUpdateFailHTLC this_ptr_conv;
32175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32176 this_ptr_conv.is_owned = false;
32177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32178 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32181 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32182 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32183 int64_t ret_ref = 0;
32184 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32185 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32187 ret_ref = (uintptr_t)ret_var.inner;
32188 if (ret_var.is_owned) {
32193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32194 LDKUpdateFailHTLC arg_conv;
32195 arg_conv.inner = (void*)(arg & (~1));
32196 arg_conv.is_owned = false;
32197 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32198 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
32202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32203 LDKUpdateFailHTLC orig_conv;
32204 orig_conv.inner = (void*)(orig & (~1));
32205 orig_conv.is_owned = false;
32206 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32207 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32208 int64_t ret_ref = 0;
32209 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32210 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32211 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32212 ret_ref = (uintptr_t)ret_var.inner;
32213 if (ret_var.is_owned) {
32219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32220 LDKUpdateFailMalformedHTLC this_obj_conv;
32221 this_obj_conv.inner = (void*)(this_obj & (~1));
32222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32224 UpdateFailMalformedHTLC_free(this_obj_conv);
32227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32228 LDKUpdateFailMalformedHTLC this_ptr_conv;
32229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32230 this_ptr_conv.is_owned = false;
32231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32232 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32233 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
32237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32238 LDKUpdateFailMalformedHTLC this_ptr_conv;
32239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32240 this_ptr_conv.is_owned = false;
32241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32242 LDKThirtyTwoBytes val_ref;
32243 CHECK((*env)->GetArrayLength(env, val) == 32);
32244 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32245 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32249 LDKUpdateFailMalformedHTLC this_ptr_conv;
32250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32251 this_ptr_conv.is_owned = false;
32252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32253 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32258 LDKUpdateFailMalformedHTLC this_ptr_conv;
32259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32260 this_ptr_conv.is_owned = false;
32261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32262 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32265 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
32266 LDKUpdateFailMalformedHTLC this_ptr_conv;
32267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32268 this_ptr_conv.is_owned = false;
32269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32270 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32275 LDKUpdateFailMalformedHTLC this_ptr_conv;
32276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32277 this_ptr_conv.is_owned = false;
32278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32279 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32282 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32283 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32284 int64_t ret_ref = 0;
32285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32288 ret_ref = (uintptr_t)ret_var.inner;
32289 if (ret_var.is_owned) {
32294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32295 LDKUpdateFailMalformedHTLC arg_conv;
32296 arg_conv.inner = (void*)(arg & (~1));
32297 arg_conv.is_owned = false;
32298 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32299 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32304 LDKUpdateFailMalformedHTLC orig_conv;
32305 orig_conv.inner = (void*)(orig & (~1));
32306 orig_conv.is_owned = false;
32307 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32308 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32309 int64_t ret_ref = 0;
32310 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32311 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32313 ret_ref = (uintptr_t)ret_var.inner;
32314 if (ret_var.is_owned) {
32320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32321 LDKCommitmentSigned this_obj_conv;
32322 this_obj_conv.inner = (void*)(this_obj & (~1));
32323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32325 CommitmentSigned_free(this_obj_conv);
32328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32329 LDKCommitmentSigned this_ptr_conv;
32330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32331 this_ptr_conv.is_owned = false;
32332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32333 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32334 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
32338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32339 LDKCommitmentSigned this_ptr_conv;
32340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32341 this_ptr_conv.is_owned = false;
32342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32343 LDKThirtyTwoBytes val_ref;
32344 CHECK((*env)->GetArrayLength(env, val) == 32);
32345 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32346 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32350 LDKCommitmentSigned this_ptr_conv;
32351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32352 this_ptr_conv.is_owned = false;
32353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32354 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32355 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
32359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32360 LDKCommitmentSigned this_ptr_conv;
32361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32362 this_ptr_conv.is_owned = false;
32363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32364 LDKSignature val_ref;
32365 CHECK((*env)->GetArrayLength(env, val) == 64);
32366 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32367 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
32371 LDKCommitmentSigned this_ptr_conv;
32372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32373 this_ptr_conv.is_owned = false;
32374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32375 LDKCVec_SignatureZ val_constr;
32376 val_constr.datalen = (*env)->GetArrayLength(env, val);
32377 if (val_constr.datalen > 0)
32378 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32380 val_constr.data = NULL;
32381 for (size_t i = 0; i < val_constr.datalen; i++) {
32382 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
32383 LDKSignature val_conv_8_ref;
32384 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
32385 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
32386 val_constr.data[i] = val_conv_8_ref;
32388 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
32391 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) {
32392 LDKThirtyTwoBytes channel_id_arg_ref;
32393 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32394 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32395 LDKSignature signature_arg_ref;
32396 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32397 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32398 LDKCVec_SignatureZ htlc_signatures_arg_constr;
32399 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
32400 if (htlc_signatures_arg_constr.datalen > 0)
32401 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32403 htlc_signatures_arg_constr.data = NULL;
32404 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
32405 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
32406 LDKSignature htlc_signatures_arg_conv_8_ref;
32407 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
32408 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
32409 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
32411 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
32412 int64_t ret_ref = 0;
32413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32416 ret_ref = (uintptr_t)ret_var.inner;
32417 if (ret_var.is_owned) {
32423 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
32424 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
32425 int64_t ret_ref = 0;
32426 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32427 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32429 ret_ref = (uintptr_t)ret_var.inner;
32430 if (ret_var.is_owned) {
32435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32436 LDKCommitmentSigned arg_conv;
32437 arg_conv.inner = (void*)(arg & (~1));
32438 arg_conv.is_owned = false;
32439 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32440 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
32444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32445 LDKCommitmentSigned orig_conv;
32446 orig_conv.inner = (void*)(orig & (~1));
32447 orig_conv.is_owned = false;
32448 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32449 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
32450 int64_t ret_ref = 0;
32451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32454 ret_ref = (uintptr_t)ret_var.inner;
32455 if (ret_var.is_owned) {
32461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32462 LDKRevokeAndACK this_obj_conv;
32463 this_obj_conv.inner = (void*)(this_obj & (~1));
32464 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32466 RevokeAndACK_free(this_obj_conv);
32469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32470 LDKRevokeAndACK this_ptr_conv;
32471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32472 this_ptr_conv.is_owned = false;
32473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32474 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32475 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
32479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32480 LDKRevokeAndACK this_ptr_conv;
32481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32482 this_ptr_conv.is_owned = false;
32483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32484 LDKThirtyTwoBytes val_ref;
32485 CHECK((*env)->GetArrayLength(env, val) == 32);
32486 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32487 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
32490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
32491 LDKRevokeAndACK this_ptr_conv;
32492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32493 this_ptr_conv.is_owned = false;
32494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32495 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32496 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
32500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32501 LDKRevokeAndACK this_ptr_conv;
32502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32503 this_ptr_conv.is_owned = false;
32504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32505 LDKThirtyTwoBytes val_ref;
32506 CHECK((*env)->GetArrayLength(env, val) == 32);
32507 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32508 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
32511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32512 LDKRevokeAndACK this_ptr_conv;
32513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32514 this_ptr_conv.is_owned = false;
32515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32516 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32517 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
32521 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) {
32522 LDKRevokeAndACK this_ptr_conv;
32523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32524 this_ptr_conv.is_owned = false;
32525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32526 LDKPublicKey val_ref;
32527 CHECK((*env)->GetArrayLength(env, val) == 33);
32528 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32529 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32532 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) {
32533 LDKThirtyTwoBytes channel_id_arg_ref;
32534 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32535 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32536 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
32537 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
32538 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
32539 LDKPublicKey next_per_commitment_point_arg_ref;
32540 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
32541 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
32542 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
32543 int64_t ret_ref = 0;
32544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32547 ret_ref = (uintptr_t)ret_var.inner;
32548 if (ret_var.is_owned) {
32554 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
32555 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
32556 int64_t ret_ref = 0;
32557 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32558 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32560 ret_ref = (uintptr_t)ret_var.inner;
32561 if (ret_var.is_owned) {
32566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32567 LDKRevokeAndACK arg_conv;
32568 arg_conv.inner = (void*)(arg & (~1));
32569 arg_conv.is_owned = false;
32570 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32571 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
32575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32576 LDKRevokeAndACK orig_conv;
32577 orig_conv.inner = (void*)(orig & (~1));
32578 orig_conv.is_owned = false;
32579 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32580 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
32581 int64_t ret_ref = 0;
32582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32585 ret_ref = (uintptr_t)ret_var.inner;
32586 if (ret_var.is_owned) {
32592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32593 LDKUpdateFee this_obj_conv;
32594 this_obj_conv.inner = (void*)(this_obj & (~1));
32595 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32597 UpdateFee_free(this_obj_conv);
32600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32601 LDKUpdateFee this_ptr_conv;
32602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32603 this_ptr_conv.is_owned = false;
32604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32605 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32606 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
32610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32611 LDKUpdateFee this_ptr_conv;
32612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32613 this_ptr_conv.is_owned = false;
32614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32615 LDKThirtyTwoBytes val_ref;
32616 CHECK((*env)->GetArrayLength(env, val) == 32);
32617 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32618 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
32621 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
32622 LDKUpdateFee this_ptr_conv;
32623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32624 this_ptr_conv.is_owned = false;
32625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32626 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
32630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32631 LDKUpdateFee this_ptr_conv;
32632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32633 this_ptr_conv.is_owned = false;
32634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32635 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
32638 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) {
32639 LDKThirtyTwoBytes channel_id_arg_ref;
32640 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32641 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32642 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
32643 int64_t ret_ref = 0;
32644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32647 ret_ref = (uintptr_t)ret_var.inner;
32648 if (ret_var.is_owned) {
32654 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
32655 LDKUpdateFee ret_var = UpdateFee_clone(arg);
32656 int64_t ret_ref = 0;
32657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32660 ret_ref = (uintptr_t)ret_var.inner;
32661 if (ret_var.is_owned) {
32666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32667 LDKUpdateFee arg_conv;
32668 arg_conv.inner = (void*)(arg & (~1));
32669 arg_conv.is_owned = false;
32670 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32671 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
32675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32676 LDKUpdateFee orig_conv;
32677 orig_conv.inner = (void*)(orig & (~1));
32678 orig_conv.is_owned = false;
32679 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32680 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
32681 int64_t ret_ref = 0;
32682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32685 ret_ref = (uintptr_t)ret_var.inner;
32686 if (ret_var.is_owned) {
32692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32693 LDKDataLossProtect this_obj_conv;
32694 this_obj_conv.inner = (void*)(this_obj & (~1));
32695 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32697 DataLossProtect_free(this_obj_conv);
32700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
32701 LDKDataLossProtect this_ptr_conv;
32702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32703 this_ptr_conv.is_owned = false;
32704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32705 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
32710 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) {
32711 LDKDataLossProtect 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 LDKThirtyTwoBytes val_ref;
32716 CHECK((*env)->GetArrayLength(env, val) == 32);
32717 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32718 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
32721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32722 LDKDataLossProtect this_ptr_conv;
32723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32724 this_ptr_conv.is_owned = false;
32725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32726 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32727 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
32731 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) {
32732 LDKDataLossProtect 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 LDKPublicKey val_ref;
32737 CHECK((*env)->GetArrayLength(env, val) == 33);
32738 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32739 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
32742 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) {
32743 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
32744 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
32745 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
32746 LDKPublicKey my_current_per_commitment_point_arg_ref;
32747 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
32748 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
32749 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
32750 int64_t ret_ref = 0;
32751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32754 ret_ref = (uintptr_t)ret_var.inner;
32755 if (ret_var.is_owned) {
32761 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
32762 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
32763 int64_t ret_ref = 0;
32764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32767 ret_ref = (uintptr_t)ret_var.inner;
32768 if (ret_var.is_owned) {
32773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32774 LDKDataLossProtect arg_conv;
32775 arg_conv.inner = (void*)(arg & (~1));
32776 arg_conv.is_owned = false;
32777 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32778 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
32782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32783 LDKDataLossProtect orig_conv;
32784 orig_conv.inner = (void*)(orig & (~1));
32785 orig_conv.is_owned = false;
32786 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32787 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
32788 int64_t ret_ref = 0;
32789 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32790 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32792 ret_ref = (uintptr_t)ret_var.inner;
32793 if (ret_var.is_owned) {
32799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32800 LDKChannelReestablish this_obj_conv;
32801 this_obj_conv.inner = (void*)(this_obj & (~1));
32802 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32804 ChannelReestablish_free(this_obj_conv);
32807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32808 LDKChannelReestablish this_ptr_conv;
32809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32810 this_ptr_conv.is_owned = false;
32811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32812 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32813 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
32817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32818 LDKChannelReestablish this_ptr_conv;
32819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32820 this_ptr_conv.is_owned = false;
32821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32822 LDKThirtyTwoBytes val_ref;
32823 CHECK((*env)->GetArrayLength(env, val) == 32);
32824 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32825 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
32828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32829 LDKChannelReestablish this_ptr_conv;
32830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32831 this_ptr_conv.is_owned = false;
32832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32833 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
32837 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) {
32838 LDKChannelReestablish this_ptr_conv;
32839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32840 this_ptr_conv.is_owned = false;
32841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32842 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
32845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32846 LDKChannelReestablish this_ptr_conv;
32847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32848 this_ptr_conv.is_owned = false;
32849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32850 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
32854 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) {
32855 LDKChannelReestablish this_ptr_conv;
32856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32857 this_ptr_conv.is_owned = false;
32858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32859 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
32862 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
32863 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
32864 int64_t ret_ref = 0;
32865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32868 ret_ref = (uintptr_t)ret_var.inner;
32869 if (ret_var.is_owned) {
32874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32875 LDKChannelReestablish arg_conv;
32876 arg_conv.inner = (void*)(arg & (~1));
32877 arg_conv.is_owned = false;
32878 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32879 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
32883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32884 LDKChannelReestablish orig_conv;
32885 orig_conv.inner = (void*)(orig & (~1));
32886 orig_conv.is_owned = false;
32887 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32888 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
32889 int64_t ret_ref = 0;
32890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32893 ret_ref = (uintptr_t)ret_var.inner;
32894 if (ret_var.is_owned) {
32900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32901 LDKAnnouncementSignatures this_obj_conv;
32902 this_obj_conv.inner = (void*)(this_obj & (~1));
32903 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32905 AnnouncementSignatures_free(this_obj_conv);
32908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32909 LDKAnnouncementSignatures this_ptr_conv;
32910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32911 this_ptr_conv.is_owned = false;
32912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32913 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
32918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32919 LDKAnnouncementSignatures this_ptr_conv;
32920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32921 this_ptr_conv.is_owned = false;
32922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32923 LDKThirtyTwoBytes val_ref;
32924 CHECK((*env)->GetArrayLength(env, val) == 32);
32925 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32926 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
32929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32930 LDKAnnouncementSignatures this_ptr_conv;
32931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32932 this_ptr_conv.is_owned = false;
32933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32934 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
32938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32939 LDKAnnouncementSignatures this_ptr_conv;
32940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32941 this_ptr_conv.is_owned = false;
32942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32943 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
32946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32947 LDKAnnouncementSignatures this_ptr_conv;
32948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32949 this_ptr_conv.is_owned = false;
32950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32951 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32952 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
32956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32957 LDKAnnouncementSignatures this_ptr_conv;
32958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32959 this_ptr_conv.is_owned = false;
32960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32961 LDKSignature val_ref;
32962 CHECK((*env)->GetArrayLength(env, val) == 64);
32963 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32964 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
32967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32968 LDKAnnouncementSignatures this_ptr_conv;
32969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32970 this_ptr_conv.is_owned = false;
32971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32972 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32973 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
32977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32978 LDKAnnouncementSignatures this_ptr_conv;
32979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32980 this_ptr_conv.is_owned = false;
32981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32982 LDKSignature val_ref;
32983 CHECK((*env)->GetArrayLength(env, val) == 64);
32984 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32985 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
32988 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) {
32989 LDKThirtyTwoBytes channel_id_arg_ref;
32990 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32991 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32992 LDKSignature node_signature_arg_ref;
32993 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
32994 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
32995 LDKSignature bitcoin_signature_arg_ref;
32996 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
32997 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
32998 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
32999 int64_t ret_ref = 0;
33000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33003 ret_ref = (uintptr_t)ret_var.inner;
33004 if (ret_var.is_owned) {
33010 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33011 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33012 int64_t ret_ref = 0;
33013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33016 ret_ref = (uintptr_t)ret_var.inner;
33017 if (ret_var.is_owned) {
33022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33023 LDKAnnouncementSignatures arg_conv;
33024 arg_conv.inner = (void*)(arg & (~1));
33025 arg_conv.is_owned = false;
33026 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33027 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
33031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33032 LDKAnnouncementSignatures orig_conv;
33033 orig_conv.inner = (void*)(orig & (~1));
33034 orig_conv.is_owned = false;
33035 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33036 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33037 int64_t ret_ref = 0;
33038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33041 ret_ref = (uintptr_t)ret_var.inner;
33042 if (ret_var.is_owned) {
33048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33049 if ((this_ptr & 1) != 0) return;
33050 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33051 CHECK_ACCESS(this_ptr_ptr);
33052 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33053 FREE((void*)this_ptr);
33054 NetAddress_free(this_ptr_conv);
33057 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33058 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33059 *ret_copy = NetAddress_clone(arg);
33060 int64_t ret_ref = (uintptr_t)ret_copy;
33063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33064 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
33065 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
33069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33070 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
33071 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33072 *ret_copy = NetAddress_clone(orig_conv);
33073 int64_t ret_ref = (uintptr_t)ret_copy;
33077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33078 LDKFourBytes addr_ref;
33079 CHECK((*env)->GetArrayLength(env, addr) == 4);
33080 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
33081 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33082 *ret_copy = NetAddress_ipv4(addr_ref, port);
33083 int64_t ret_ref = (uintptr_t)ret_copy;
33087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33088 LDKSixteenBytes addr_ref;
33089 CHECK((*env)->GetArrayLength(env, addr) == 16);
33090 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
33091 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33092 *ret_copy = NetAddress_ipv6(addr_ref, port);
33093 int64_t ret_ref = (uintptr_t)ret_copy;
33097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
33098 LDKTwelveBytes a_ref;
33099 CHECK((*env)->GetArrayLength(env, a) == 12);
33100 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
33101 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33102 *ret_copy = NetAddress_onion_v2(a_ref);
33103 int64_t ret_ref = (uintptr_t)ret_copy;
33107 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) {
33108 LDKThirtyTwoBytes ed25519_pubkey_ref;
33109 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
33110 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
33111 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33112 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33113 int64_t ret_ref = (uintptr_t)ret_copy;
33117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
33118 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
33119 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33120 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33121 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33122 CVec_u8Z_free(ret_var);
33126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33127 LDKu8slice ser_ref;
33128 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33129 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33130 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33131 *ret_conv = NetAddress_read(ser_ref);
33132 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33133 return (int64_t)ret_conv;
33136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33137 LDKUnsignedNodeAnnouncement this_obj_conv;
33138 this_obj_conv.inner = (void*)(this_obj & (~1));
33139 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33141 UnsignedNodeAnnouncement_free(this_obj_conv);
33144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33145 LDKUnsignedNodeAnnouncement this_ptr_conv;
33146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33147 this_ptr_conv.is_owned = false;
33148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33149 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33150 int64_t ret_ref = 0;
33151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33154 ret_ref = (uintptr_t)ret_var.inner;
33155 if (ret_var.is_owned) {
33161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33162 LDKUnsignedNodeAnnouncement this_ptr_conv;
33163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33164 this_ptr_conv.is_owned = false;
33165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33166 LDKNodeFeatures val_conv;
33167 val_conv.inner = (void*)(val & (~1));
33168 val_conv.is_owned = (val & 1) || (val == 0);
33169 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33170 val_conv = NodeFeatures_clone(&val_conv);
33171 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33174 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33175 LDKUnsignedNodeAnnouncement this_ptr_conv;
33176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33177 this_ptr_conv.is_owned = false;
33178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33179 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33184 LDKUnsignedNodeAnnouncement this_ptr_conv;
33185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33186 this_ptr_conv.is_owned = false;
33187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33188 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33192 LDKUnsignedNodeAnnouncement this_ptr_conv;
33193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33194 this_ptr_conv.is_owned = false;
33195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33196 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33197 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
33201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33202 LDKUnsignedNodeAnnouncement 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 LDKPublicKey val_ref;
33207 CHECK((*env)->GetArrayLength(env, val) == 33);
33208 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33209 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
33212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
33213 LDKUnsignedNodeAnnouncement this_ptr_conv;
33214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33215 this_ptr_conv.is_owned = false;
33216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33217 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
33218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
33222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33223 LDKUnsignedNodeAnnouncement this_ptr_conv;
33224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33225 this_ptr_conv.is_owned = false;
33226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33227 LDKThreeBytes val_ref;
33228 CHECK((*env)->GetArrayLength(env, val) == 3);
33229 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
33230 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33234 LDKUnsignedNodeAnnouncement this_ptr_conv;
33235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33236 this_ptr_conv.is_owned = false;
33237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33238 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33239 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
33243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33244 LDKUnsignedNodeAnnouncement this_ptr_conv;
33245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33246 this_ptr_conv.is_owned = false;
33247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33248 LDKThirtyTwoBytes val_ref;
33249 CHECK((*env)->GetArrayLength(env, val) == 32);
33250 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33251 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
33254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33255 LDKUnsignedNodeAnnouncement this_ptr_conv;
33256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33257 this_ptr_conv.is_owned = false;
33258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33259 LDKCVec_NetAddressZ val_constr;
33260 val_constr.datalen = (*env)->GetArrayLength(env, val);
33261 if (val_constr.datalen > 0)
33262 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
33264 val_constr.data = NULL;
33265 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33266 for (size_t m = 0; m < val_constr.datalen; m++) {
33267 int64_t val_conv_12 = val_vals[m];
33268 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
33269 CHECK_ACCESS(val_conv_12_ptr);
33270 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
33271 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
33272 val_constr.data[m] = val_conv_12_conv;
33274 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33275 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
33278 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
33279 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
33280 int64_t ret_ref = 0;
33281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33284 ret_ref = (uintptr_t)ret_var.inner;
33285 if (ret_var.is_owned) {
33290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33291 LDKUnsignedNodeAnnouncement arg_conv;
33292 arg_conv.inner = (void*)(arg & (~1));
33293 arg_conv.is_owned = false;
33294 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33295 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
33299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33300 LDKUnsignedNodeAnnouncement orig_conv;
33301 orig_conv.inner = (void*)(orig & (~1));
33302 orig_conv.is_owned = false;
33303 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33304 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
33305 int64_t ret_ref = 0;
33306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33309 ret_ref = (uintptr_t)ret_var.inner;
33310 if (ret_var.is_owned) {
33316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33317 LDKNodeAnnouncement this_obj_conv;
33318 this_obj_conv.inner = (void*)(this_obj & (~1));
33319 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33321 NodeAnnouncement_free(this_obj_conv);
33324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33325 LDKNodeAnnouncement this_ptr_conv;
33326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33327 this_ptr_conv.is_owned = false;
33328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33329 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33330 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
33334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33335 LDKNodeAnnouncement this_ptr_conv;
33336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33337 this_ptr_conv.is_owned = false;
33338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33339 LDKSignature val_ref;
33340 CHECK((*env)->GetArrayLength(env, val) == 64);
33341 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33342 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
33345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33346 LDKNodeAnnouncement this_ptr_conv;
33347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33348 this_ptr_conv.is_owned = false;
33349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33350 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
33351 int64_t ret_ref = 0;
33352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33355 ret_ref = (uintptr_t)ret_var.inner;
33356 if (ret_var.is_owned) {
33362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33363 LDKNodeAnnouncement this_ptr_conv;
33364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33365 this_ptr_conv.is_owned = false;
33366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33367 LDKUnsignedNodeAnnouncement val_conv;
33368 val_conv.inner = (void*)(val & (~1));
33369 val_conv.is_owned = (val & 1) || (val == 0);
33370 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33371 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
33372 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
33375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
33376 LDKSignature signature_arg_ref;
33377 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33378 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33379 LDKUnsignedNodeAnnouncement contents_arg_conv;
33380 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33381 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33382 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33383 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
33384 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
33385 int64_t ret_ref = 0;
33386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33389 ret_ref = (uintptr_t)ret_var.inner;
33390 if (ret_var.is_owned) {
33396 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
33397 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
33398 int64_t ret_ref = 0;
33399 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33400 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33402 ret_ref = (uintptr_t)ret_var.inner;
33403 if (ret_var.is_owned) {
33408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33409 LDKNodeAnnouncement arg_conv;
33410 arg_conv.inner = (void*)(arg & (~1));
33411 arg_conv.is_owned = false;
33412 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33413 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
33417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33418 LDKNodeAnnouncement orig_conv;
33419 orig_conv.inner = (void*)(orig & (~1));
33420 orig_conv.is_owned = false;
33421 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33422 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
33423 int64_t ret_ref = 0;
33424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33427 ret_ref = (uintptr_t)ret_var.inner;
33428 if (ret_var.is_owned) {
33434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33435 LDKUnsignedChannelAnnouncement this_obj_conv;
33436 this_obj_conv.inner = (void*)(this_obj & (~1));
33437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33439 UnsignedChannelAnnouncement_free(this_obj_conv);
33442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33443 LDKUnsignedChannelAnnouncement this_ptr_conv;
33444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33445 this_ptr_conv.is_owned = false;
33446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33447 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
33448 int64_t ret_ref = 0;
33449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33452 ret_ref = (uintptr_t)ret_var.inner;
33453 if (ret_var.is_owned) {
33459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33460 LDKUnsignedChannelAnnouncement this_ptr_conv;
33461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33462 this_ptr_conv.is_owned = false;
33463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33464 LDKChannelFeatures val_conv;
33465 val_conv.inner = (void*)(val & (~1));
33466 val_conv.is_owned = (val & 1) || (val == 0);
33467 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33468 val_conv = ChannelFeatures_clone(&val_conv);
33469 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
33472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33473 LDKUnsignedChannelAnnouncement this_ptr_conv;
33474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33475 this_ptr_conv.is_owned = false;
33476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33477 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33478 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
33482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33483 LDKUnsignedChannelAnnouncement this_ptr_conv;
33484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33485 this_ptr_conv.is_owned = false;
33486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33487 LDKThirtyTwoBytes val_ref;
33488 CHECK((*env)->GetArrayLength(env, val) == 32);
33489 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33490 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
33493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33494 LDKUnsignedChannelAnnouncement this_ptr_conv;
33495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33496 this_ptr_conv.is_owned = false;
33497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33498 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
33502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33503 LDKUnsignedChannelAnnouncement this_ptr_conv;
33504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33505 this_ptr_conv.is_owned = false;
33506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33507 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
33510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33511 LDKUnsignedChannelAnnouncement this_ptr_conv;
33512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33513 this_ptr_conv.is_owned = false;
33514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33515 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33516 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
33520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33521 LDKUnsignedChannelAnnouncement this_ptr_conv;
33522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33523 this_ptr_conv.is_owned = false;
33524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33525 LDKPublicKey val_ref;
33526 CHECK((*env)->GetArrayLength(env, val) == 33);
33527 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33528 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
33531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33532 LDKUnsignedChannelAnnouncement this_ptr_conv;
33533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33534 this_ptr_conv.is_owned = false;
33535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33536 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33537 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
33541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33542 LDKUnsignedChannelAnnouncement this_ptr_conv;
33543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33544 this_ptr_conv.is_owned = false;
33545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33546 LDKPublicKey val_ref;
33547 CHECK((*env)->GetArrayLength(env, val) == 33);
33548 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33549 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
33552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33553 LDKUnsignedChannelAnnouncement 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33558 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
33562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33563 LDKUnsignedChannelAnnouncement this_ptr_conv;
33564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33565 this_ptr_conv.is_owned = false;
33566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33567 LDKPublicKey val_ref;
33568 CHECK((*env)->GetArrayLength(env, val) == 33);
33569 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33570 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
33573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33574 LDKUnsignedChannelAnnouncement this_ptr_conv;
33575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33576 this_ptr_conv.is_owned = false;
33577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33578 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33579 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
33583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33584 LDKUnsignedChannelAnnouncement this_ptr_conv;
33585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33586 this_ptr_conv.is_owned = false;
33587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33588 LDKPublicKey val_ref;
33589 CHECK((*env)->GetArrayLength(env, val) == 33);
33590 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33591 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
33594 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
33595 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
33596 int64_t ret_ref = 0;
33597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33600 ret_ref = (uintptr_t)ret_var.inner;
33601 if (ret_var.is_owned) {
33606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33607 LDKUnsignedChannelAnnouncement arg_conv;
33608 arg_conv.inner = (void*)(arg & (~1));
33609 arg_conv.is_owned = false;
33610 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33611 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
33615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33616 LDKUnsignedChannelAnnouncement orig_conv;
33617 orig_conv.inner = (void*)(orig & (~1));
33618 orig_conv.is_owned = false;
33619 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33620 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
33621 int64_t ret_ref = 0;
33622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33625 ret_ref = (uintptr_t)ret_var.inner;
33626 if (ret_var.is_owned) {
33632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33633 LDKChannelAnnouncement this_obj_conv;
33634 this_obj_conv.inner = (void*)(this_obj & (~1));
33635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33637 ChannelAnnouncement_free(this_obj_conv);
33640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33641 LDKChannelAnnouncement this_ptr_conv;
33642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33643 this_ptr_conv.is_owned = false;
33644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33645 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33646 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
33650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33651 LDKChannelAnnouncement this_ptr_conv;
33652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33653 this_ptr_conv.is_owned = false;
33654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33655 LDKSignature val_ref;
33656 CHECK((*env)->GetArrayLength(env, val) == 64);
33657 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33658 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
33661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33662 LDKChannelAnnouncement this_ptr_conv;
33663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33664 this_ptr_conv.is_owned = false;
33665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33666 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33667 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
33671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33672 LDKChannelAnnouncement this_ptr_conv;
33673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33674 this_ptr_conv.is_owned = false;
33675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33676 LDKSignature val_ref;
33677 CHECK((*env)->GetArrayLength(env, val) == 64);
33678 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33679 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
33682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33683 LDKChannelAnnouncement this_ptr_conv;
33684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33685 this_ptr_conv.is_owned = false;
33686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33687 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33688 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
33692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33693 LDKChannelAnnouncement this_ptr_conv;
33694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33695 this_ptr_conv.is_owned = false;
33696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33697 LDKSignature val_ref;
33698 CHECK((*env)->GetArrayLength(env, val) == 64);
33699 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33700 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
33703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33704 LDKChannelAnnouncement this_ptr_conv;
33705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33706 this_ptr_conv.is_owned = false;
33707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33708 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33709 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
33713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33714 LDKChannelAnnouncement this_ptr_conv;
33715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33716 this_ptr_conv.is_owned = false;
33717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33718 LDKSignature val_ref;
33719 CHECK((*env)->GetArrayLength(env, val) == 64);
33720 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33721 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
33724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33725 LDKChannelAnnouncement this_ptr_conv;
33726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33727 this_ptr_conv.is_owned = false;
33728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33729 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_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_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33742 LDKChannelAnnouncement this_ptr_conv;
33743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33744 this_ptr_conv.is_owned = false;
33745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33746 LDKUnsignedChannelAnnouncement val_conv;
33747 val_conv.inner = (void*)(val & (~1));
33748 val_conv.is_owned = (val & 1) || (val == 0);
33749 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33750 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
33751 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
33754 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) {
33755 LDKSignature node_signature_1_arg_ref;
33756 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
33757 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
33758 LDKSignature node_signature_2_arg_ref;
33759 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
33760 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
33761 LDKSignature bitcoin_signature_1_arg_ref;
33762 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
33763 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
33764 LDKSignature bitcoin_signature_2_arg_ref;
33765 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
33766 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
33767 LDKUnsignedChannelAnnouncement contents_arg_conv;
33768 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33769 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33770 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33771 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
33772 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);
33773 int64_t ret_ref = 0;
33774 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33775 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33777 ret_ref = (uintptr_t)ret_var.inner;
33778 if (ret_var.is_owned) {
33784 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
33785 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
33786 int64_t ret_ref = 0;
33787 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33788 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33789 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33790 ret_ref = (uintptr_t)ret_var.inner;
33791 if (ret_var.is_owned) {
33796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33797 LDKChannelAnnouncement arg_conv;
33798 arg_conv.inner = (void*)(arg & (~1));
33799 arg_conv.is_owned = false;
33800 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33801 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
33805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33806 LDKChannelAnnouncement orig_conv;
33807 orig_conv.inner = (void*)(orig & (~1));
33808 orig_conv.is_owned = false;
33809 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33810 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
33811 int64_t ret_ref = 0;
33812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33815 ret_ref = (uintptr_t)ret_var.inner;
33816 if (ret_var.is_owned) {
33822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33823 LDKUnsignedChannelUpdate this_obj_conv;
33824 this_obj_conv.inner = (void*)(this_obj & (~1));
33825 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33827 UnsignedChannelUpdate_free(this_obj_conv);
33830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33831 LDKUnsignedChannelUpdate this_ptr_conv;
33832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33833 this_ptr_conv.is_owned = false;
33834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33835 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33836 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
33840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33841 LDKUnsignedChannelUpdate this_ptr_conv;
33842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33843 this_ptr_conv.is_owned = false;
33844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33845 LDKThirtyTwoBytes val_ref;
33846 CHECK((*env)->GetArrayLength(env, val) == 32);
33847 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33848 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
33851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33852 LDKUnsignedChannelUpdate this_ptr_conv;
33853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33854 this_ptr_conv.is_owned = false;
33855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33856 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
33860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33861 LDKUnsignedChannelUpdate this_ptr_conv;
33862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33863 this_ptr_conv.is_owned = false;
33864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33865 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
33868 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33869 LDKUnsignedChannelUpdate this_ptr_conv;
33870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33871 this_ptr_conv.is_owned = false;
33872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33873 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
33877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33878 LDKUnsignedChannelUpdate this_ptr_conv;
33879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33880 this_ptr_conv.is_owned = false;
33881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33882 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
33885 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
33886 LDKUnsignedChannelUpdate this_ptr_conv;
33887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33888 this_ptr_conv.is_owned = false;
33889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33890 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
33894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
33895 LDKUnsignedChannelUpdate this_ptr_conv;
33896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33897 this_ptr_conv.is_owned = false;
33898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33899 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
33902 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
33903 LDKUnsignedChannelUpdate this_ptr_conv;
33904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33905 this_ptr_conv.is_owned = false;
33906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33907 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33912 LDKUnsignedChannelUpdate this_ptr_conv;
33913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33914 this_ptr_conv.is_owned = false;
33915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33916 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
33919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33920 LDKUnsignedChannelUpdate this_ptr_conv;
33921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33922 this_ptr_conv.is_owned = false;
33923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33924 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
33928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33929 LDKUnsignedChannelUpdate this_ptr_conv;
33930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33931 this_ptr_conv.is_owned = false;
33932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33933 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
33936 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33937 LDKUnsignedChannelUpdate 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 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
33945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33946 LDKUnsignedChannelUpdate this_ptr_conv;
33947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33948 this_ptr_conv.is_owned = false;
33949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33950 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
33953 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
33954 LDKUnsignedChannelUpdate this_ptr_conv;
33955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33956 this_ptr_conv.is_owned = false;
33957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33958 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
33962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33963 LDKUnsignedChannelUpdate this_ptr_conv;
33964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33965 this_ptr_conv.is_owned = false;
33966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33967 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
33970 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
33971 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
33972 int64_t ret_ref = 0;
33973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33976 ret_ref = (uintptr_t)ret_var.inner;
33977 if (ret_var.is_owned) {
33982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33983 LDKUnsignedChannelUpdate arg_conv;
33984 arg_conv.inner = (void*)(arg & (~1));
33985 arg_conv.is_owned = false;
33986 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33987 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
33991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33992 LDKUnsignedChannelUpdate orig_conv;
33993 orig_conv.inner = (void*)(orig & (~1));
33994 orig_conv.is_owned = false;
33995 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33996 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
33997 int64_t ret_ref = 0;
33998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34001 ret_ref = (uintptr_t)ret_var.inner;
34002 if (ret_var.is_owned) {
34008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34009 LDKChannelUpdate this_obj_conv;
34010 this_obj_conv.inner = (void*)(this_obj & (~1));
34011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34013 ChannelUpdate_free(this_obj_conv);
34016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34017 LDKChannelUpdate this_ptr_conv;
34018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34019 this_ptr_conv.is_owned = false;
34020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34021 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34022 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
34026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34027 LDKChannelUpdate this_ptr_conv;
34028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34029 this_ptr_conv.is_owned = false;
34030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34031 LDKSignature val_ref;
34032 CHECK((*env)->GetArrayLength(env, val) == 64);
34033 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34034 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34038 LDKChannelUpdate this_ptr_conv;
34039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34040 this_ptr_conv.is_owned = false;
34041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34042 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34043 int64_t ret_ref = 0;
34044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34047 ret_ref = (uintptr_t)ret_var.inner;
34048 if (ret_var.is_owned) {
34054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34055 LDKChannelUpdate this_ptr_conv;
34056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34057 this_ptr_conv.is_owned = false;
34058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34059 LDKUnsignedChannelUpdate val_conv;
34060 val_conv.inner = (void*)(val & (~1));
34061 val_conv.is_owned = (val & 1) || (val == 0);
34062 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34063 val_conv = UnsignedChannelUpdate_clone(&val_conv);
34064 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34068 LDKSignature signature_arg_ref;
34069 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34070 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34071 LDKUnsignedChannelUpdate contents_arg_conv;
34072 contents_arg_conv.inner = (void*)(contents_arg & (~1));
34073 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
34074 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34075 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
34076 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
34077 int64_t ret_ref = 0;
34078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34081 ret_ref = (uintptr_t)ret_var.inner;
34082 if (ret_var.is_owned) {
34088 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
34089 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
34090 int64_t ret_ref = 0;
34091 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34092 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34094 ret_ref = (uintptr_t)ret_var.inner;
34095 if (ret_var.is_owned) {
34100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34101 LDKChannelUpdate arg_conv;
34102 arg_conv.inner = (void*)(arg & (~1));
34103 arg_conv.is_owned = false;
34104 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34105 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
34109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34110 LDKChannelUpdate orig_conv;
34111 orig_conv.inner = (void*)(orig & (~1));
34112 orig_conv.is_owned = false;
34113 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34114 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
34115 int64_t ret_ref = 0;
34116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34119 ret_ref = (uintptr_t)ret_var.inner;
34120 if (ret_var.is_owned) {
34126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34127 LDKQueryChannelRange this_obj_conv;
34128 this_obj_conv.inner = (void*)(this_obj & (~1));
34129 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34131 QueryChannelRange_free(this_obj_conv);
34134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34135 LDKQueryChannelRange this_ptr_conv;
34136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34137 this_ptr_conv.is_owned = false;
34138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34139 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34140 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
34144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34145 LDKQueryChannelRange this_ptr_conv;
34146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34147 this_ptr_conv.is_owned = false;
34148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34149 LDKThirtyTwoBytes val_ref;
34150 CHECK((*env)->GetArrayLength(env, val) == 32);
34151 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34152 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34155 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34156 LDKQueryChannelRange this_ptr_conv;
34157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34158 this_ptr_conv.is_owned = false;
34159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34160 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
34164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34165 LDKQueryChannelRange this_ptr_conv;
34166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34167 this_ptr_conv.is_owned = false;
34168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34169 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
34172 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34173 LDKQueryChannelRange this_ptr_conv;
34174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34175 this_ptr_conv.is_owned = false;
34176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34177 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
34181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34182 LDKQueryChannelRange this_ptr_conv;
34183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34184 this_ptr_conv.is_owned = false;
34185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34186 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34189 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) {
34190 LDKThirtyTwoBytes chain_hash_arg_ref;
34191 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34192 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34193 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
34194 int64_t ret_ref = 0;
34195 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34196 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34198 ret_ref = (uintptr_t)ret_var.inner;
34199 if (ret_var.is_owned) {
34205 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
34206 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
34207 int64_t ret_ref = 0;
34208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34211 ret_ref = (uintptr_t)ret_var.inner;
34212 if (ret_var.is_owned) {
34217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34218 LDKQueryChannelRange arg_conv;
34219 arg_conv.inner = (void*)(arg & (~1));
34220 arg_conv.is_owned = false;
34221 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34222 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
34226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34227 LDKQueryChannelRange orig_conv;
34228 orig_conv.inner = (void*)(orig & (~1));
34229 orig_conv.is_owned = false;
34230 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34231 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
34232 int64_t ret_ref = 0;
34233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34236 ret_ref = (uintptr_t)ret_var.inner;
34237 if (ret_var.is_owned) {
34243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34244 LDKReplyChannelRange this_obj_conv;
34245 this_obj_conv.inner = (void*)(this_obj & (~1));
34246 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34248 ReplyChannelRange_free(this_obj_conv);
34251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34252 LDKReplyChannelRange this_ptr_conv;
34253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34254 this_ptr_conv.is_owned = false;
34255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34256 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34257 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
34261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34262 LDKReplyChannelRange this_ptr_conv;
34263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34264 this_ptr_conv.is_owned = false;
34265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34266 LDKThirtyTwoBytes val_ref;
34267 CHECK((*env)->GetArrayLength(env, val) == 32);
34268 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34269 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34272 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34273 LDKReplyChannelRange this_ptr_conv;
34274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34275 this_ptr_conv.is_owned = false;
34276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34277 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
34281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34282 LDKReplyChannelRange this_ptr_conv;
34283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34284 this_ptr_conv.is_owned = false;
34285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34286 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
34289 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34290 LDKReplyChannelRange this_ptr_conv;
34291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34292 this_ptr_conv.is_owned = false;
34293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34294 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
34298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34299 LDKReplyChannelRange this_ptr_conv;
34300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34301 this_ptr_conv.is_owned = false;
34302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34303 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
34307 LDKReplyChannelRange this_ptr_conv;
34308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34309 this_ptr_conv.is_owned = false;
34310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34311 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
34315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34316 LDKReplyChannelRange this_ptr_conv;
34317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34318 this_ptr_conv.is_owned = false;
34319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34320 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
34323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34324 LDKReplyChannelRange this_ptr_conv;
34325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34326 this_ptr_conv.is_owned = false;
34327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34328 LDKCVec_u64Z val_constr;
34329 val_constr.datalen = (*env)->GetArrayLength(env, val);
34330 if (val_constr.datalen > 0)
34331 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34333 val_constr.data = NULL;
34334 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34335 for (size_t g = 0; g < val_constr.datalen; g++) {
34336 int64_t val_conv_6 = val_vals[g];
34337 val_constr.data[g] = val_conv_6;
34339 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34340 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
34343 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) {
34344 LDKThirtyTwoBytes chain_hash_arg_ref;
34345 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34346 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34347 LDKCVec_u64Z short_channel_ids_arg_constr;
34348 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
34349 if (short_channel_ids_arg_constr.datalen > 0)
34350 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34352 short_channel_ids_arg_constr.data = NULL;
34353 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
34354 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
34355 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
34356 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
34358 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
34359 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
34360 int64_t ret_ref = 0;
34361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34364 ret_ref = (uintptr_t)ret_var.inner;
34365 if (ret_var.is_owned) {
34371 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
34372 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
34373 int64_t ret_ref = 0;
34374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34377 ret_ref = (uintptr_t)ret_var.inner;
34378 if (ret_var.is_owned) {
34383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34384 LDKReplyChannelRange arg_conv;
34385 arg_conv.inner = (void*)(arg & (~1));
34386 arg_conv.is_owned = false;
34387 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34388 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
34392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34393 LDKReplyChannelRange orig_conv;
34394 orig_conv.inner = (void*)(orig & (~1));
34395 orig_conv.is_owned = false;
34396 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34397 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
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) {
34409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34410 LDKQueryShortChannelIds this_obj_conv;
34411 this_obj_conv.inner = (void*)(this_obj & (~1));
34412 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34414 QueryShortChannelIds_free(this_obj_conv);
34417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34418 LDKQueryShortChannelIds this_ptr_conv;
34419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34420 this_ptr_conv.is_owned = false;
34421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34422 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34423 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
34427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34428 LDKQueryShortChannelIds this_ptr_conv;
34429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34430 this_ptr_conv.is_owned = false;
34431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34432 LDKThirtyTwoBytes val_ref;
34433 CHECK((*env)->GetArrayLength(env, val) == 32);
34434 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34435 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
34438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34439 LDKQueryShortChannelIds this_ptr_conv;
34440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34441 this_ptr_conv.is_owned = false;
34442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34443 LDKCVec_u64Z val_constr;
34444 val_constr.datalen = (*env)->GetArrayLength(env, val);
34445 if (val_constr.datalen > 0)
34446 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34448 val_constr.data = NULL;
34449 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34450 for (size_t g = 0; g < val_constr.datalen; g++) {
34451 int64_t val_conv_6 = val_vals[g];
34452 val_constr.data[g] = val_conv_6;
34454 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34455 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
34458 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) {
34459 LDKThirtyTwoBytes chain_hash_arg_ref;
34460 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34461 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34462 LDKCVec_u64Z short_channel_ids_arg_constr;
34463 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
34464 if (short_channel_ids_arg_constr.datalen > 0)
34465 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34467 short_channel_ids_arg_constr.data = NULL;
34468 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
34469 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
34470 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
34471 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
34473 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
34474 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
34475 int64_t ret_ref = 0;
34476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34479 ret_ref = (uintptr_t)ret_var.inner;
34480 if (ret_var.is_owned) {
34486 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
34487 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
34488 int64_t ret_ref = 0;
34489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34492 ret_ref = (uintptr_t)ret_var.inner;
34493 if (ret_var.is_owned) {
34498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34499 LDKQueryShortChannelIds arg_conv;
34500 arg_conv.inner = (void*)(arg & (~1));
34501 arg_conv.is_owned = false;
34502 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34503 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
34507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34508 LDKQueryShortChannelIds orig_conv;
34509 orig_conv.inner = (void*)(orig & (~1));
34510 orig_conv.is_owned = false;
34511 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34512 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
34513 int64_t ret_ref = 0;
34514 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34515 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34517 ret_ref = (uintptr_t)ret_var.inner;
34518 if (ret_var.is_owned) {
34524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34525 LDKReplyShortChannelIdsEnd this_obj_conv;
34526 this_obj_conv.inner = (void*)(this_obj & (~1));
34527 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34529 ReplyShortChannelIdsEnd_free(this_obj_conv);
34532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34533 LDKReplyShortChannelIdsEnd this_ptr_conv;
34534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34535 this_ptr_conv.is_owned = false;
34536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34537 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34538 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
34542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34543 LDKReplyShortChannelIdsEnd this_ptr_conv;
34544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34545 this_ptr_conv.is_owned = false;
34546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34547 LDKThirtyTwoBytes val_ref;
34548 CHECK((*env)->GetArrayLength(env, val) == 32);
34549 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34550 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
34553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
34554 LDKReplyShortChannelIdsEnd this_ptr_conv;
34555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34556 this_ptr_conv.is_owned = false;
34557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34558 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
34562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34563 LDKReplyShortChannelIdsEnd this_ptr_conv;
34564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34565 this_ptr_conv.is_owned = false;
34566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34567 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
34570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
34571 LDKThirtyTwoBytes chain_hash_arg_ref;
34572 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34573 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34574 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
34575 int64_t ret_ref = 0;
34576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34579 ret_ref = (uintptr_t)ret_var.inner;
34580 if (ret_var.is_owned) {
34586 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
34587 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
34588 int64_t ret_ref = 0;
34589 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34590 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34592 ret_ref = (uintptr_t)ret_var.inner;
34593 if (ret_var.is_owned) {
34598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34599 LDKReplyShortChannelIdsEnd arg_conv;
34600 arg_conv.inner = (void*)(arg & (~1));
34601 arg_conv.is_owned = false;
34602 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34603 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
34607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34608 LDKReplyShortChannelIdsEnd orig_conv;
34609 orig_conv.inner = (void*)(orig & (~1));
34610 orig_conv.is_owned = false;
34611 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34612 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
34613 int64_t ret_ref = 0;
34614 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34615 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34617 ret_ref = (uintptr_t)ret_var.inner;
34618 if (ret_var.is_owned) {
34624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34625 LDKGossipTimestampFilter this_obj_conv;
34626 this_obj_conv.inner = (void*)(this_obj & (~1));
34627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34629 GossipTimestampFilter_free(this_obj_conv);
34632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34633 LDKGossipTimestampFilter this_ptr_conv;
34634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34635 this_ptr_conv.is_owned = false;
34636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34637 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34638 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
34642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34643 LDKGossipTimestampFilter this_ptr_conv;
34644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34645 this_ptr_conv.is_owned = false;
34646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34647 LDKThirtyTwoBytes val_ref;
34648 CHECK((*env)->GetArrayLength(env, val) == 32);
34649 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34650 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
34653 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34654 LDKGossipTimestampFilter this_ptr_conv;
34655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34656 this_ptr_conv.is_owned = false;
34657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34658 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
34662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34663 LDKGossipTimestampFilter this_ptr_conv;
34664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34665 this_ptr_conv.is_owned = false;
34666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34667 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
34670 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
34671 LDKGossipTimestampFilter this_ptr_conv;
34672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34673 this_ptr_conv.is_owned = false;
34674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34675 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
34679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34680 LDKGossipTimestampFilter this_ptr_conv;
34681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34682 this_ptr_conv.is_owned = false;
34683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34684 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
34687 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) {
34688 LDKThirtyTwoBytes chain_hash_arg_ref;
34689 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34690 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34691 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
34692 int64_t ret_ref = 0;
34693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34696 ret_ref = (uintptr_t)ret_var.inner;
34697 if (ret_var.is_owned) {
34703 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
34704 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
34705 int64_t ret_ref = 0;
34706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34709 ret_ref = (uintptr_t)ret_var.inner;
34710 if (ret_var.is_owned) {
34715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34716 LDKGossipTimestampFilter arg_conv;
34717 arg_conv.inner = (void*)(arg & (~1));
34718 arg_conv.is_owned = false;
34719 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34720 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
34724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34725 LDKGossipTimestampFilter orig_conv;
34726 orig_conv.inner = (void*)(orig & (~1));
34727 orig_conv.is_owned = false;
34728 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34729 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
34730 int64_t ret_ref = 0;
34731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34734 ret_ref = (uintptr_t)ret_var.inner;
34735 if (ret_var.is_owned) {
34741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34742 if ((this_ptr & 1) != 0) return;
34743 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34744 CHECK_ACCESS(this_ptr_ptr);
34745 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
34746 FREE((void*)this_ptr);
34747 ErrorAction_free(this_ptr_conv);
34750 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
34751 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34752 *ret_copy = ErrorAction_clone(arg);
34753 int64_t ret_ref = (uintptr_t)ret_copy;
34756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34757 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
34758 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
34762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34763 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
34764 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34765 *ret_copy = ErrorAction_clone(orig_conv);
34766 int64_t ret_ref = (uintptr_t)ret_copy;
34770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
34771 LDKErrorMessage msg_conv;
34772 msg_conv.inner = (void*)(msg & (~1));
34773 msg_conv.is_owned = (msg & 1) || (msg == 0);
34774 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34775 msg_conv = ErrorMessage_clone(&msg_conv);
34776 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34777 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
34778 int64_t ret_ref = (uintptr_t)ret_copy;
34782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
34783 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34784 *ret_copy = ErrorAction_ignore_error();
34785 int64_t ret_ref = (uintptr_t)ret_copy;
34789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
34790 LDKLevel a_conv = LDKLevel_from_java(env, a);
34791 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34792 *ret_copy = ErrorAction_ignore_and_log(a_conv);
34793 int64_t ret_ref = (uintptr_t)ret_copy;
34797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
34798 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34799 *ret_copy = ErrorAction_ignore_duplicate_gossip();
34800 int64_t ret_ref = (uintptr_t)ret_copy;
34804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
34805 LDKErrorMessage msg_conv;
34806 msg_conv.inner = (void*)(msg & (~1));
34807 msg_conv.is_owned = (msg & 1) || (msg == 0);
34808 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34809 msg_conv = ErrorMessage_clone(&msg_conv);
34810 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34811 *ret_copy = ErrorAction_send_error_message(msg_conv);
34812 int64_t ret_ref = (uintptr_t)ret_copy;
34816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
34817 LDKWarningMessage msg_conv;
34818 msg_conv.inner = (void*)(msg & (~1));
34819 msg_conv.is_owned = (msg & 1) || (msg == 0);
34820 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34821 msg_conv = WarningMessage_clone(&msg_conv);
34822 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
34823 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34824 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
34825 int64_t ret_ref = (uintptr_t)ret_copy;
34829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34830 LDKLightningError this_obj_conv;
34831 this_obj_conv.inner = (void*)(this_obj & (~1));
34832 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34834 LightningError_free(this_obj_conv);
34837 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
34838 LDKLightningError this_ptr_conv;
34839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34840 this_ptr_conv.is_owned = false;
34841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34842 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
34843 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
34849 LDKLightningError this_ptr_conv;
34850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34851 this_ptr_conv.is_owned = false;
34852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34853 LDKStr val_conv = java_to_owned_str(env, val);
34854 LightningError_set_err(&this_ptr_conv, val_conv);
34857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
34858 LDKLightningError this_ptr_conv;
34859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34860 this_ptr_conv.is_owned = false;
34861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34862 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34863 *ret_copy = LightningError_get_action(&this_ptr_conv);
34864 int64_t ret_ref = (uintptr_t)ret_copy;
34868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34869 LDKLightningError this_ptr_conv;
34870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34871 this_ptr_conv.is_owned = false;
34872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34873 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34874 CHECK_ACCESS(val_ptr);
34875 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
34876 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
34877 LightningError_set_action(&this_ptr_conv, val_conv);
34880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
34881 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
34882 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
34883 CHECK_ACCESS(action_arg_ptr);
34884 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
34885 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
34886 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
34887 int64_t ret_ref = 0;
34888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34891 ret_ref = (uintptr_t)ret_var.inner;
34892 if (ret_var.is_owned) {
34898 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
34899 LDKLightningError ret_var = LightningError_clone(arg);
34900 int64_t ret_ref = 0;
34901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34904 ret_ref = (uintptr_t)ret_var.inner;
34905 if (ret_var.is_owned) {
34910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34911 LDKLightningError arg_conv;
34912 arg_conv.inner = (void*)(arg & (~1));
34913 arg_conv.is_owned = false;
34914 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34915 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
34919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34920 LDKLightningError orig_conv;
34921 orig_conv.inner = (void*)(orig & (~1));
34922 orig_conv.is_owned = false;
34923 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34924 LDKLightningError ret_var = LightningError_clone(&orig_conv);
34925 int64_t ret_ref = 0;
34926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34929 ret_ref = (uintptr_t)ret_var.inner;
34930 if (ret_var.is_owned) {
34936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34937 LDKCommitmentUpdate this_obj_conv;
34938 this_obj_conv.inner = (void*)(this_obj & (~1));
34939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34941 CommitmentUpdate_free(this_obj_conv);
34944 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34945 LDKCommitmentUpdate this_ptr_conv;
34946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34947 this_ptr_conv.is_owned = false;
34948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34949 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
34950 int64_tArray ret_arr = NULL;
34951 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34952 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34953 for (size_t p = 0; p < ret_var.datalen; p++) {
34954 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
34955 int64_t ret_conv_15_ref = 0;
34956 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34957 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
34959 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
34960 if (ret_conv_15_var.is_owned) {
34961 ret_conv_15_ref |= 1;
34963 ret_arr_ptr[p] = ret_conv_15_ref;
34965 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34966 FREE(ret_var.data);
34970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34971 LDKCommitmentUpdate this_ptr_conv;
34972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34973 this_ptr_conv.is_owned = false;
34974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34975 LDKCVec_UpdateAddHTLCZ val_constr;
34976 val_constr.datalen = (*env)->GetArrayLength(env, val);
34977 if (val_constr.datalen > 0)
34978 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34980 val_constr.data = NULL;
34981 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34982 for (size_t p = 0; p < val_constr.datalen; p++) {
34983 int64_t val_conv_15 = val_vals[p];
34984 LDKUpdateAddHTLC val_conv_15_conv;
34985 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
34986 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
34987 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
34988 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
34989 val_constr.data[p] = val_conv_15_conv;
34991 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34992 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
34995 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34996 LDKCommitmentUpdate this_ptr_conv;
34997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34998 this_ptr_conv.is_owned = false;
34999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35000 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35001 int64_tArray ret_arr = NULL;
35002 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35003 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35004 for (size_t t = 0; t < ret_var.datalen; t++) {
35005 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35006 int64_t ret_conv_19_ref = 0;
35007 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35008 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35010 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
35011 if (ret_conv_19_var.is_owned) {
35012 ret_conv_19_ref |= 1;
35014 ret_arr_ptr[t] = ret_conv_19_ref;
35016 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35017 FREE(ret_var.data);
35021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35022 LDKCommitmentUpdate this_ptr_conv;
35023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35024 this_ptr_conv.is_owned = false;
35025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35026 LDKCVec_UpdateFulfillHTLCZ val_constr;
35027 val_constr.datalen = (*env)->GetArrayLength(env, val);
35028 if (val_constr.datalen > 0)
35029 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35031 val_constr.data = NULL;
35032 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35033 for (size_t t = 0; t < val_constr.datalen; t++) {
35034 int64_t val_conv_19 = val_vals[t];
35035 LDKUpdateFulfillHTLC val_conv_19_conv;
35036 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
35037 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
35038 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35039 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35040 val_constr.data[t] = val_conv_19_conv;
35042 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35043 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35046 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35047 LDKCommitmentUpdate this_ptr_conv;
35048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35049 this_ptr_conv.is_owned = false;
35050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35051 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35052 int64_tArray ret_arr = NULL;
35053 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35054 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35055 for (size_t q = 0; q < ret_var.datalen; q++) {
35056 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35057 int64_t ret_conv_16_ref = 0;
35058 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35059 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35061 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
35062 if (ret_conv_16_var.is_owned) {
35063 ret_conv_16_ref |= 1;
35065 ret_arr_ptr[q] = ret_conv_16_ref;
35067 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35068 FREE(ret_var.data);
35072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35073 LDKCommitmentUpdate this_ptr_conv;
35074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35075 this_ptr_conv.is_owned = false;
35076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35077 LDKCVec_UpdateFailHTLCZ val_constr;
35078 val_constr.datalen = (*env)->GetArrayLength(env, val);
35079 if (val_constr.datalen > 0)
35080 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35082 val_constr.data = NULL;
35083 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35084 for (size_t q = 0; q < val_constr.datalen; q++) {
35085 int64_t val_conv_16 = val_vals[q];
35086 LDKUpdateFailHTLC val_conv_16_conv;
35087 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
35088 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
35089 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35090 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
35091 val_constr.data[q] = val_conv_16_conv;
35093 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35094 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
35097 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35098 LDKCommitmentUpdate this_ptr_conv;
35099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35100 this_ptr_conv.is_owned = false;
35101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35102 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
35103 int64_tArray ret_arr = NULL;
35104 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35105 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35106 for (size_t z = 0; z < ret_var.datalen; z++) {
35107 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
35108 int64_t ret_conv_25_ref = 0;
35109 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35110 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
35112 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
35113 if (ret_conv_25_var.is_owned) {
35114 ret_conv_25_ref |= 1;
35116 ret_arr_ptr[z] = ret_conv_25_ref;
35118 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35119 FREE(ret_var.data);
35123 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) {
35124 LDKCommitmentUpdate this_ptr_conv;
35125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35126 this_ptr_conv.is_owned = false;
35127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35128 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
35129 val_constr.datalen = (*env)->GetArrayLength(env, val);
35130 if (val_constr.datalen > 0)
35131 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35133 val_constr.data = NULL;
35134 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35135 for (size_t z = 0; z < val_constr.datalen; z++) {
35136 int64_t val_conv_25 = val_vals[z];
35137 LDKUpdateFailMalformedHTLC val_conv_25_conv;
35138 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
35139 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
35140 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
35141 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
35142 val_constr.data[z] = val_conv_25_conv;
35144 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35145 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
35148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
35149 LDKCommitmentUpdate this_ptr_conv;
35150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35151 this_ptr_conv.is_owned = false;
35152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35153 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
35154 int64_t ret_ref = 0;
35155 if ((uintptr_t)ret_var.inner > 4096) {
35156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35159 ret_ref = (uintptr_t)ret_var.inner;
35160 if (ret_var.is_owned) {
35167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35168 LDKCommitmentUpdate this_ptr_conv;
35169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35170 this_ptr_conv.is_owned = false;
35171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35172 LDKUpdateFee val_conv;
35173 val_conv.inner = (void*)(val & (~1));
35174 val_conv.is_owned = (val & 1) || (val == 0);
35175 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35176 val_conv = UpdateFee_clone(&val_conv);
35177 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
35180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
35181 LDKCommitmentUpdate this_ptr_conv;
35182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35183 this_ptr_conv.is_owned = false;
35184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35185 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
35186 int64_t ret_ref = 0;
35187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35190 ret_ref = (uintptr_t)ret_var.inner;
35191 if (ret_var.is_owned) {
35197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35198 LDKCommitmentUpdate this_ptr_conv;
35199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35200 this_ptr_conv.is_owned = false;
35201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35202 LDKCommitmentSigned val_conv;
35203 val_conv.inner = (void*)(val & (~1));
35204 val_conv.is_owned = (val & 1) || (val == 0);
35205 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35206 val_conv = CommitmentSigned_clone(&val_conv);
35207 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
35210 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) {
35211 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
35212 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
35213 if (update_add_htlcs_arg_constr.datalen > 0)
35214 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35216 update_add_htlcs_arg_constr.data = NULL;
35217 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
35218 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
35219 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
35220 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
35221 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
35222 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
35223 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
35224 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
35225 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
35227 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
35228 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
35229 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
35230 if (update_fulfill_htlcs_arg_constr.datalen > 0)
35231 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35233 update_fulfill_htlcs_arg_constr.data = NULL;
35234 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
35235 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
35236 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
35237 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
35238 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
35239 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
35240 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
35241 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
35242 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
35244 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
35245 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
35246 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
35247 if (update_fail_htlcs_arg_constr.datalen > 0)
35248 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35250 update_fail_htlcs_arg_constr.data = NULL;
35251 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
35252 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
35253 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
35254 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
35255 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
35256 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
35257 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
35258 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
35259 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
35261 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
35262 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
35263 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
35264 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
35265 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35267 update_fail_malformed_htlcs_arg_constr.data = NULL;
35268 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
35269 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
35270 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
35271 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
35272 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
35273 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);
35274 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
35275 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
35276 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
35278 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
35279 LDKUpdateFee update_fee_arg_conv;
35280 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
35281 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
35282 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
35283 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
35284 LDKCommitmentSigned commitment_signed_arg_conv;
35285 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
35286 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
35287 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
35288 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
35289 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);
35290 int64_t ret_ref = 0;
35291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35294 ret_ref = (uintptr_t)ret_var.inner;
35295 if (ret_var.is_owned) {
35301 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
35302 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
35303 int64_t ret_ref = 0;
35304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35307 ret_ref = (uintptr_t)ret_var.inner;
35308 if (ret_var.is_owned) {
35313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35314 LDKCommitmentUpdate arg_conv;
35315 arg_conv.inner = (void*)(arg & (~1));
35316 arg_conv.is_owned = false;
35317 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35318 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
35322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35323 LDKCommitmentUpdate orig_conv;
35324 orig_conv.inner = (void*)(orig & (~1));
35325 orig_conv.is_owned = false;
35326 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35327 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
35328 int64_t ret_ref = 0;
35329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35332 ret_ref = (uintptr_t)ret_var.inner;
35333 if (ret_var.is_owned) {
35339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35340 if ((this_ptr & 1) != 0) return;
35341 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35342 CHECK_ACCESS(this_ptr_ptr);
35343 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
35344 FREE((void*)this_ptr);
35345 ChannelMessageHandler_free(this_ptr_conv);
35348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35349 if ((this_ptr & 1) != 0) return;
35350 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35351 CHECK_ACCESS(this_ptr_ptr);
35352 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
35353 FREE((void*)this_ptr);
35354 RoutingMessageHandler_free(this_ptr_conv);
35357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
35358 LDKAcceptChannel obj_conv;
35359 obj_conv.inner = (void*)(obj & (~1));
35360 obj_conv.is_owned = false;
35361 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35362 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
35363 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35364 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35365 CVec_u8Z_free(ret_var);
35369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35370 LDKu8slice ser_ref;
35371 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35372 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35373 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
35374 *ret_conv = AcceptChannel_read(ser_ref);
35375 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35376 return (int64_t)ret_conv;
35379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35380 LDKAnnouncementSignatures obj_conv;
35381 obj_conv.inner = (void*)(obj & (~1));
35382 obj_conv.is_owned = false;
35383 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35384 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
35385 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35386 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35387 CVec_u8Z_free(ret_var);
35391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35392 LDKu8slice ser_ref;
35393 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35394 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35395 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
35396 *ret_conv = AnnouncementSignatures_read(ser_ref);
35397 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35398 return (int64_t)ret_conv;
35401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
35402 LDKChannelReestablish obj_conv;
35403 obj_conv.inner = (void*)(obj & (~1));
35404 obj_conv.is_owned = false;
35405 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35406 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
35407 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35408 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35409 CVec_u8Z_free(ret_var);
35413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35414 LDKu8slice ser_ref;
35415 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35416 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35417 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
35418 *ret_conv = ChannelReestablish_read(ser_ref);
35419 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35420 return (int64_t)ret_conv;
35423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35424 LDKClosingSigned obj_conv;
35425 obj_conv.inner = (void*)(obj & (~1));
35426 obj_conv.is_owned = false;
35427 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35428 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
35429 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35430 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35431 CVec_u8Z_free(ret_var);
35435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35436 LDKu8slice ser_ref;
35437 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35438 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35439 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
35440 *ret_conv = ClosingSigned_read(ser_ref);
35441 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35442 return (int64_t)ret_conv;
35445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
35446 LDKClosingSignedFeeRange obj_conv;
35447 obj_conv.inner = (void*)(obj & (~1));
35448 obj_conv.is_owned = false;
35449 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35450 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
35451 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35452 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35453 CVec_u8Z_free(ret_var);
35457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35458 LDKu8slice ser_ref;
35459 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35460 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35461 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
35462 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
35463 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35464 return (int64_t)ret_conv;
35467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35468 LDKCommitmentSigned obj_conv;
35469 obj_conv.inner = (void*)(obj & (~1));
35470 obj_conv.is_owned = false;
35471 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35472 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
35473 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35474 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35475 CVec_u8Z_free(ret_var);
35479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35480 LDKu8slice ser_ref;
35481 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35482 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35483 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
35484 *ret_conv = CommitmentSigned_read(ser_ref);
35485 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35486 return (int64_t)ret_conv;
35489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
35490 LDKFundingCreated obj_conv;
35491 obj_conv.inner = (void*)(obj & (~1));
35492 obj_conv.is_owned = false;
35493 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35494 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
35495 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35496 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35497 CVec_u8Z_free(ret_var);
35501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35502 LDKu8slice ser_ref;
35503 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35504 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35505 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
35506 *ret_conv = FundingCreated_read(ser_ref);
35507 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35508 return (int64_t)ret_conv;
35511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35512 LDKFundingSigned obj_conv;
35513 obj_conv.inner = (void*)(obj & (~1));
35514 obj_conv.is_owned = false;
35515 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35516 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
35517 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35518 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35519 CVec_u8Z_free(ret_var);
35523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35524 LDKu8slice ser_ref;
35525 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35526 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35527 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
35528 *ret_conv = FundingSigned_read(ser_ref);
35529 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35530 return (int64_t)ret_conv;
35533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
35534 LDKFundingLocked obj_conv;
35535 obj_conv.inner = (void*)(obj & (~1));
35536 obj_conv.is_owned = false;
35537 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35538 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
35539 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35540 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35541 CVec_u8Z_free(ret_var);
35545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35546 LDKu8slice ser_ref;
35547 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35548 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35549 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
35550 *ret_conv = FundingLocked_read(ser_ref);
35551 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35552 return (int64_t)ret_conv;
35555 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
35557 obj_conv.inner = (void*)(obj & (~1));
35558 obj_conv.is_owned = false;
35559 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35560 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
35561 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35562 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35563 CVec_u8Z_free(ret_var);
35567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35568 LDKu8slice ser_ref;
35569 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35570 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35571 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
35572 *ret_conv = Init_read(ser_ref);
35573 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35574 return (int64_t)ret_conv;
35577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
35578 LDKOpenChannel obj_conv;
35579 obj_conv.inner = (void*)(obj & (~1));
35580 obj_conv.is_owned = false;
35581 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35582 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
35583 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35584 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35585 CVec_u8Z_free(ret_var);
35589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35590 LDKu8slice ser_ref;
35591 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35592 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35593 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
35594 *ret_conv = OpenChannel_read(ser_ref);
35595 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35596 return (int64_t)ret_conv;
35599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
35600 LDKRevokeAndACK obj_conv;
35601 obj_conv.inner = (void*)(obj & (~1));
35602 obj_conv.is_owned = false;
35603 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35604 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
35605 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35606 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35607 CVec_u8Z_free(ret_var);
35611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35612 LDKu8slice ser_ref;
35613 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35614 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35615 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35616 *ret_conv = RevokeAndACK_read(ser_ref);
35617 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35618 return (int64_t)ret_conv;
35621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
35622 LDKShutdown obj_conv;
35623 obj_conv.inner = (void*)(obj & (~1));
35624 obj_conv.is_owned = false;
35625 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35626 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
35627 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35628 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35629 CVec_u8Z_free(ret_var);
35633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35634 LDKu8slice ser_ref;
35635 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35636 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35637 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35638 *ret_conv = Shutdown_read(ser_ref);
35639 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35640 return (int64_t)ret_conv;
35643 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35644 LDKUpdateFailHTLC obj_conv;
35645 obj_conv.inner = (void*)(obj & (~1));
35646 obj_conv.is_owned = false;
35647 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35648 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
35649 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35650 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35651 CVec_u8Z_free(ret_var);
35655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35656 LDKu8slice ser_ref;
35657 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35658 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35659 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35660 *ret_conv = UpdateFailHTLC_read(ser_ref);
35661 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35662 return (int64_t)ret_conv;
35665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35666 LDKUpdateFailMalformedHTLC obj_conv;
35667 obj_conv.inner = (void*)(obj & (~1));
35668 obj_conv.is_owned = false;
35669 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35670 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
35671 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35672 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35673 CVec_u8Z_free(ret_var);
35677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35678 LDKu8slice ser_ref;
35679 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35680 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35681 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35682 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
35683 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35684 return (int64_t)ret_conv;
35687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
35688 LDKUpdateFee obj_conv;
35689 obj_conv.inner = (void*)(obj & (~1));
35690 obj_conv.is_owned = false;
35691 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35692 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
35693 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35694 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35695 CVec_u8Z_free(ret_var);
35699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35700 LDKu8slice ser_ref;
35701 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35702 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35703 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35704 *ret_conv = UpdateFee_read(ser_ref);
35705 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35706 return (int64_t)ret_conv;
35709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35710 LDKUpdateFulfillHTLC obj_conv;
35711 obj_conv.inner = (void*)(obj & (~1));
35712 obj_conv.is_owned = false;
35713 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35714 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
35715 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35716 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35717 CVec_u8Z_free(ret_var);
35721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35722 LDKu8slice ser_ref;
35723 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35724 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35725 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35726 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
35727 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35728 return (int64_t)ret_conv;
35731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35732 LDKUpdateAddHTLC obj_conv;
35733 obj_conv.inner = (void*)(obj & (~1));
35734 obj_conv.is_owned = false;
35735 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35736 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
35737 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35738 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35739 CVec_u8Z_free(ret_var);
35743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35744 LDKu8slice ser_ref;
35745 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35746 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35747 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35748 *ret_conv = UpdateAddHTLC_read(ser_ref);
35749 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35750 return (int64_t)ret_conv;
35753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
35755 obj_conv.inner = (void*)(obj & (~1));
35756 obj_conv.is_owned = false;
35757 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35758 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
35759 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35760 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35761 CVec_u8Z_free(ret_var);
35765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35766 LDKu8slice ser_ref;
35767 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35768 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35769 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35770 *ret_conv = Ping_read(ser_ref);
35771 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35772 return (int64_t)ret_conv;
35775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
35777 obj_conv.inner = (void*)(obj & (~1));
35778 obj_conv.is_owned = false;
35779 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35780 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
35781 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35782 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35783 CVec_u8Z_free(ret_var);
35787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35788 LDKu8slice ser_ref;
35789 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35790 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35791 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35792 *ret_conv = Pong_read(ser_ref);
35793 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35794 return (int64_t)ret_conv;
35797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35798 LDKUnsignedChannelAnnouncement obj_conv;
35799 obj_conv.inner = (void*)(obj & (~1));
35800 obj_conv.is_owned = false;
35801 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35802 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
35803 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35804 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35805 CVec_u8Z_free(ret_var);
35809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35810 LDKu8slice ser_ref;
35811 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35812 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35813 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35814 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
35815 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35816 return (int64_t)ret_conv;
35819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35820 LDKChannelAnnouncement obj_conv;
35821 obj_conv.inner = (void*)(obj & (~1));
35822 obj_conv.is_owned = false;
35823 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35824 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
35825 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35826 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35827 CVec_u8Z_free(ret_var);
35831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35832 LDKu8slice ser_ref;
35833 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35834 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35835 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35836 *ret_conv = ChannelAnnouncement_read(ser_ref);
35837 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35838 return (int64_t)ret_conv;
35841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35842 LDKUnsignedChannelUpdate obj_conv;
35843 obj_conv.inner = (void*)(obj & (~1));
35844 obj_conv.is_owned = false;
35845 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35846 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
35847 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35848 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35849 CVec_u8Z_free(ret_var);
35853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35854 LDKu8slice ser_ref;
35855 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35856 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35857 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35858 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
35859 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35860 return (int64_t)ret_conv;
35863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35864 LDKChannelUpdate obj_conv;
35865 obj_conv.inner = (void*)(obj & (~1));
35866 obj_conv.is_owned = false;
35867 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35868 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
35869 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35870 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35871 CVec_u8Z_free(ret_var);
35875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35876 LDKu8slice ser_ref;
35877 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35878 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35879 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35880 *ret_conv = ChannelUpdate_read(ser_ref);
35881 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35882 return (int64_t)ret_conv;
35885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35886 LDKErrorMessage obj_conv;
35887 obj_conv.inner = (void*)(obj & (~1));
35888 obj_conv.is_owned = false;
35889 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35890 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
35891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35893 CVec_u8Z_free(ret_var);
35897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35898 LDKu8slice ser_ref;
35899 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35900 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35901 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35902 *ret_conv = ErrorMessage_read(ser_ref);
35903 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35904 return (int64_t)ret_conv;
35907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35908 LDKWarningMessage obj_conv;
35909 obj_conv.inner = (void*)(obj & (~1));
35910 obj_conv.is_owned = false;
35911 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35912 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
35913 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35914 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35915 CVec_u8Z_free(ret_var);
35919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35920 LDKu8slice ser_ref;
35921 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35922 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35923 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35924 *ret_conv = WarningMessage_read(ser_ref);
35925 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35926 return (int64_t)ret_conv;
35929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35930 LDKUnsignedNodeAnnouncement obj_conv;
35931 obj_conv.inner = (void*)(obj & (~1));
35932 obj_conv.is_owned = false;
35933 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35934 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
35935 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35936 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35937 CVec_u8Z_free(ret_var);
35941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35942 LDKu8slice ser_ref;
35943 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35944 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35945 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35946 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
35947 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35948 return (int64_t)ret_conv;
35951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35952 LDKNodeAnnouncement obj_conv;
35953 obj_conv.inner = (void*)(obj & (~1));
35954 obj_conv.is_owned = false;
35955 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35956 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
35957 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35958 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35959 CVec_u8Z_free(ret_var);
35963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35964 LDKu8slice ser_ref;
35965 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35966 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35967 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
35968 *ret_conv = NodeAnnouncement_read(ser_ref);
35969 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35970 return (int64_t)ret_conv;
35973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35974 LDKu8slice ser_ref;
35975 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35976 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35977 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
35978 *ret_conv = QueryShortChannelIds_read(ser_ref);
35979 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35980 return (int64_t)ret_conv;
35983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
35984 LDKQueryShortChannelIds obj_conv;
35985 obj_conv.inner = (void*)(obj & (~1));
35986 obj_conv.is_owned = false;
35987 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35988 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
35989 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35990 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35991 CVec_u8Z_free(ret_var);
35995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
35996 LDKReplyShortChannelIdsEnd obj_conv;
35997 obj_conv.inner = (void*)(obj & (~1));
35998 obj_conv.is_owned = false;
35999 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36000 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36001 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36002 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36003 CVec_u8Z_free(ret_var);
36007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36008 LDKu8slice ser_ref;
36009 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36010 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36011 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36012 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36013 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36014 return (int64_t)ret_conv;
36017 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
36018 LDKQueryChannelRange this_arg_conv;
36019 this_arg_conv.inner = (void*)(this_arg & (~1));
36020 this_arg_conv.is_owned = false;
36021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36022 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
36026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36027 LDKQueryChannelRange obj_conv;
36028 obj_conv.inner = (void*)(obj & (~1));
36029 obj_conv.is_owned = false;
36030 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36031 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36032 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36033 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36034 CVec_u8Z_free(ret_var);
36038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36039 LDKu8slice ser_ref;
36040 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36041 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36042 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36043 *ret_conv = QueryChannelRange_read(ser_ref);
36044 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36045 return (int64_t)ret_conv;
36048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36049 LDKu8slice ser_ref;
36050 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36051 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36052 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36053 *ret_conv = ReplyChannelRange_read(ser_ref);
36054 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36055 return (int64_t)ret_conv;
36058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36059 LDKReplyChannelRange obj_conv;
36060 obj_conv.inner = (void*)(obj & (~1));
36061 obj_conv.is_owned = false;
36062 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36063 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36064 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36065 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36066 CVec_u8Z_free(ret_var);
36070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
36071 LDKGossipTimestampFilter obj_conv;
36072 obj_conv.inner = (void*)(obj & (~1));
36073 obj_conv.is_owned = false;
36074 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36075 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
36076 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36077 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36078 CVec_u8Z_free(ret_var);
36082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36083 LDKu8slice ser_ref;
36084 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36085 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36086 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36087 *ret_conv = GossipTimestampFilter_read(ser_ref);
36088 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36089 return (int64_t)ret_conv;
36092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36093 if ((this_ptr & 1) != 0) return;
36094 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36095 CHECK_ACCESS(this_ptr_ptr);
36096 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
36097 FREE((void*)this_ptr);
36098 CustomMessageHandler_free(this_ptr_conv);
36101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36102 LDKIgnoringMessageHandler this_obj_conv;
36103 this_obj_conv.inner = (void*)(this_obj & (~1));
36104 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36106 IgnoringMessageHandler_free(this_obj_conv);
36109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
36110 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
36111 int64_t ret_ref = 0;
36112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36115 ret_ref = (uintptr_t)ret_var.inner;
36116 if (ret_var.is_owned) {
36122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36123 LDKIgnoringMessageHandler this_arg_conv;
36124 this_arg_conv.inner = (void*)(this_arg & (~1));
36125 this_arg_conv.is_owned = false;
36126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36127 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36128 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36129 return (int64_t)ret_ret;
36132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36133 LDKIgnoringMessageHandler this_arg_conv;
36134 this_arg_conv.inner = (void*)(this_arg & (~1));
36135 this_arg_conv.is_owned = false;
36136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36137 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
36138 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
36139 return (int64_t)ret_ret;
36142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
36143 LDKIgnoringMessageHandler this_arg_conv;
36144 this_arg_conv.inner = (void*)(this_arg & (~1));
36145 this_arg_conv.is_owned = false;
36146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36147 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
36148 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
36149 return (int64_t)ret_ret;
36152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36153 LDKIgnoringMessageHandler this_arg_conv;
36154 this_arg_conv.inner = (void*)(this_arg & (~1));
36155 this_arg_conv.is_owned = false;
36156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36157 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
36158 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
36159 return (int64_t)ret_ret;
36162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36163 LDKErroringMessageHandler this_obj_conv;
36164 this_obj_conv.inner = (void*)(this_obj & (~1));
36165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36167 ErroringMessageHandler_free(this_obj_conv);
36170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
36171 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
36172 int64_t ret_ref = 0;
36173 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36174 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36176 ret_ref = (uintptr_t)ret_var.inner;
36177 if (ret_var.is_owned) {
36183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36184 LDKErroringMessageHandler this_arg_conv;
36185 this_arg_conv.inner = (void*)(this_arg & (~1));
36186 this_arg_conv.is_owned = false;
36187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36188 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36189 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36190 return (int64_t)ret_ret;
36193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36194 LDKErroringMessageHandler this_arg_conv;
36195 this_arg_conv.inner = (void*)(this_arg & (~1));
36196 this_arg_conv.is_owned = false;
36197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36198 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36199 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
36200 return (int64_t)ret_ret;
36203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36204 LDKMessageHandler this_obj_conv;
36205 this_obj_conv.inner = (void*)(this_obj & (~1));
36206 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36208 MessageHandler_free(this_obj_conv);
36211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36212 LDKMessageHandler this_ptr_conv;
36213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36214 this_ptr_conv.is_owned = false;
36215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36216 // WARNING: This object doesn't live past this scope, needs clone!
36217 int64_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
36221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36222 LDKMessageHandler this_ptr_conv;
36223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36224 this_ptr_conv.is_owned = false;
36225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36226 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36227 CHECK_ACCESS(val_ptr);
36228 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
36229 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
36230 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36231 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
36233 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
36236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36237 LDKMessageHandler this_ptr_conv;
36238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36239 this_ptr_conv.is_owned = false;
36240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36241 // WARNING: This object doesn't live past this scope, needs clone!
36242 int64_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
36246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36247 LDKMessageHandler this_ptr_conv;
36248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36249 this_ptr_conv.is_owned = false;
36250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36251 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36252 CHECK_ACCESS(val_ptr);
36253 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
36254 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36255 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36256 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
36258 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
36261 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) {
36262 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
36263 CHECK_ACCESS(chan_handler_arg_ptr);
36264 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
36265 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
36266 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36267 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
36269 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
36270 CHECK_ACCESS(route_handler_arg_ptr);
36271 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
36272 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36273 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36274 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
36276 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
36277 int64_t ret_ref = 0;
36278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36281 ret_ref = (uintptr_t)ret_var.inner;
36282 if (ret_var.is_owned) {
36288 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
36289 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36290 *ret_ret = SocketDescriptor_clone(arg);
36291 return (int64_t)ret_ret;
36293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36294 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
36295 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
36296 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
36297 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
36301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36302 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
36303 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
36304 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
36305 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36306 *ret_ret = SocketDescriptor_clone(orig_conv);
36307 return (int64_t)ret_ret;
36310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36311 if ((this_ptr & 1) != 0) return;
36312 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36313 CHECK_ACCESS(this_ptr_ptr);
36314 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
36315 FREE((void*)this_ptr);
36316 SocketDescriptor_free(this_ptr_conv);
36319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36320 LDKPeerHandleError this_obj_conv;
36321 this_obj_conv.inner = (void*)(this_obj & (~1));
36322 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36324 PeerHandleError_free(this_obj_conv);
36327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
36328 LDKPeerHandleError 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 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
36336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36337 LDKPeerHandleError this_ptr_conv;
36338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36339 this_ptr_conv.is_owned = false;
36340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36341 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
36344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
36345 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
36346 int64_t ret_ref = 0;
36347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36350 ret_ref = (uintptr_t)ret_var.inner;
36351 if (ret_var.is_owned) {
36357 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
36358 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
36359 int64_t ret_ref = 0;
36360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36363 ret_ref = (uintptr_t)ret_var.inner;
36364 if (ret_var.is_owned) {
36369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36370 LDKPeerHandleError arg_conv;
36371 arg_conv.inner = (void*)(arg & (~1));
36372 arg_conv.is_owned = false;
36373 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36374 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
36378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36379 LDKPeerHandleError orig_conv;
36380 orig_conv.inner = (void*)(orig & (~1));
36381 orig_conv.is_owned = false;
36382 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36383 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
36384 int64_t ret_ref = 0;
36385 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36386 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36388 ret_ref = (uintptr_t)ret_var.inner;
36389 if (ret_var.is_owned) {
36395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36396 LDKPeerManager this_obj_conv;
36397 this_obj_conv.inner = (void*)(this_obj & (~1));
36398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36400 PeerManager_free(this_obj_conv);
36403 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) {
36404 LDKMessageHandler message_handler_conv;
36405 message_handler_conv.inner = (void*)(message_handler & (~1));
36406 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
36407 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
36408 // WARNING: we need a move here but no clone is available for LDKMessageHandler
36409 LDKSecretKey our_node_secret_ref;
36410 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
36411 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
36412 unsigned char ephemeral_random_data_arr[32];
36413 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
36414 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
36415 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
36416 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
36417 CHECK_ACCESS(logger_ptr);
36418 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36419 if (logger_conv.free == LDKLogger_JCalls_free) {
36420 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36421 LDKLogger_JCalls_cloned(&logger_conv);
36423 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
36424 CHECK_ACCESS(custom_message_handler_ptr);
36425 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
36426 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
36427 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36428 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
36430 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
36431 int64_t ret_ref = 0;
36432 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36433 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36435 ret_ref = (uintptr_t)ret_var.inner;
36436 if (ret_var.is_owned) {
36442 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
36443 LDKPeerManager this_arg_conv;
36444 this_arg_conv.inner = (void*)(this_arg & (~1));
36445 this_arg_conv.is_owned = false;
36446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36447 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
36448 jobjectArray ret_arr = NULL;
36449 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
36451 for (size_t i = 0; i < ret_var.datalen; i++) {
36452 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
36453 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
36454 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
36457 FREE(ret_var.data);
36461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor, int64_t remote_network_address) {
36462 LDKPeerManager this_arg_conv;
36463 this_arg_conv.inner = (void*)(this_arg & (~1));
36464 this_arg_conv.is_owned = false;
36465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36466 LDKPublicKey their_node_id_ref;
36467 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
36468 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
36469 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36470 CHECK_ACCESS(descriptor_ptr);
36471 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36472 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36473 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36474 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36476 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
36477 CHECK_ACCESS(remote_network_address_ptr);
36478 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36479 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
36480 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
36481 return (int64_t)ret_conv;
36484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
36485 LDKPeerManager this_arg_conv;
36486 this_arg_conv.inner = (void*)(this_arg & (~1));
36487 this_arg_conv.is_owned = false;
36488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36489 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36490 CHECK_ACCESS(descriptor_ptr);
36491 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36492 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36493 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36494 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36496 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
36497 CHECK_ACCESS(remote_network_address_ptr);
36498 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36499 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36500 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
36501 return (int64_t)ret_conv;
36504 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) {
36505 LDKPeerManager this_arg_conv;
36506 this_arg_conv.inner = (void*)(this_arg & (~1));
36507 this_arg_conv.is_owned = false;
36508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36509 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36510 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
36511 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36512 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36513 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
36514 return (int64_t)ret_conv;
36517 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) {
36518 LDKPeerManager this_arg_conv;
36519 this_arg_conv.inner = (void*)(this_arg & (~1));
36520 this_arg_conv.is_owned = false;
36521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36522 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
36523 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
36524 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
36525 LDKu8slice data_ref;
36526 data_ref.datalen = (*env)->GetArrayLength(env, data);
36527 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
36528 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
36529 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
36530 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
36531 return (int64_t)ret_conv;
36534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
36535 LDKPeerManager this_arg_conv;
36536 this_arg_conv.inner = (void*)(this_arg & (~1));
36537 this_arg_conv.is_owned = false;
36538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36539 PeerManager_process_events(&this_arg_conv);
36542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
36543 LDKPeerManager this_arg_conv;
36544 this_arg_conv.inner = (void*)(this_arg & (~1));
36545 this_arg_conv.is_owned = false;
36546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36547 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36548 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
36549 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36550 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
36553 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) {
36554 LDKPeerManager this_arg_conv;
36555 this_arg_conv.inner = (void*)(this_arg & (~1));
36556 this_arg_conv.is_owned = false;
36557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36558 LDKPublicKey node_id_ref;
36559 CHECK((*env)->GetArrayLength(env, node_id) == 33);
36560 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
36561 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
36564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
36565 LDKPeerManager this_arg_conv;
36566 this_arg_conv.inner = (void*)(this_arg & (~1));
36567 this_arg_conv.is_owned = false;
36568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36569 PeerManager_disconnect_all_peers(&this_arg_conv);
36572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
36573 LDKPeerManager this_arg_conv;
36574 this_arg_conv.inner = (void*)(this_arg & (~1));
36575 this_arg_conv.is_owned = false;
36576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36577 PeerManager_timer_tick_occurred(&this_arg_conv);
36580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
36581 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
36585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
36586 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
36590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
36591 unsigned char commitment_seed_arr[32];
36592 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
36593 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
36594 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
36595 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36596 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
36600 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) {
36601 LDKCVec_u8Z to_holder_script_ref;
36602 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
36603 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
36604 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
36605 LDKCVec_u8Z to_counterparty_script_ref;
36606 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
36607 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
36608 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
36609 LDKOutPoint funding_outpoint_conv;
36610 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
36611 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
36612 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36613 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36614 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);
36615 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36616 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36617 Transaction_free(ret_var);
36621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36622 LDKCounterpartyCommitmentSecrets this_obj_conv;
36623 this_obj_conv.inner = (void*)(this_obj & (~1));
36624 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36626 CounterpartyCommitmentSecrets_free(this_obj_conv);
36629 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
36630 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
36631 int64_t ret_ref = 0;
36632 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36633 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36635 ret_ref = (uintptr_t)ret_var.inner;
36636 if (ret_var.is_owned) {
36641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36642 LDKCounterpartyCommitmentSecrets arg_conv;
36643 arg_conv.inner = (void*)(arg & (~1));
36644 arg_conv.is_owned = false;
36645 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36646 int64_t ret_val = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
36650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36651 LDKCounterpartyCommitmentSecrets orig_conv;
36652 orig_conv.inner = (void*)(orig & (~1));
36653 orig_conv.is_owned = false;
36654 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36655 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
36656 int64_t ret_ref = 0;
36657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36660 ret_ref = (uintptr_t)ret_var.inner;
36661 if (ret_var.is_owned) {
36667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
36668 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
36669 int64_t ret_ref = 0;
36670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36673 ret_ref = (uintptr_t)ret_var.inner;
36674 if (ret_var.is_owned) {
36680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
36681 LDKCounterpartyCommitmentSecrets this_arg_conv;
36682 this_arg_conv.inner = (void*)(this_arg & (~1));
36683 this_arg_conv.is_owned = false;
36684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36685 int64_t ret_val = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
36689 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) {
36690 LDKCounterpartyCommitmentSecrets this_arg_conv;
36691 this_arg_conv.inner = (void*)(this_arg & (~1));
36692 this_arg_conv.is_owned = false;
36693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36694 LDKThirtyTwoBytes secret_ref;
36695 CHECK((*env)->GetArrayLength(env, secret) == 32);
36696 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
36697 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36698 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
36699 return (int64_t)ret_conv;
36702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
36703 LDKCounterpartyCommitmentSecrets this_arg_conv;
36704 this_arg_conv.inner = (void*)(this_arg & (~1));
36705 this_arg_conv.is_owned = false;
36706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36707 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36708 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
36712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
36713 LDKCounterpartyCommitmentSecrets obj_conv;
36714 obj_conv.inner = (void*)(obj & (~1));
36715 obj_conv.is_owned = false;
36716 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36717 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
36718 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36719 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36720 CVec_u8Z_free(ret_var);
36724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36725 LDKu8slice ser_ref;
36726 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36727 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36728 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36729 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
36730 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36731 return (int64_t)ret_conv;
36734 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) {
36735 LDKPublicKey per_commitment_point_ref;
36736 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36737 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36738 unsigned char base_secret_arr[32];
36739 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
36740 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
36741 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
36742 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36743 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
36744 return (int64_t)ret_conv;
36747 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) {
36748 LDKPublicKey per_commitment_point_ref;
36749 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36750 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36751 LDKPublicKey base_point_ref;
36752 CHECK((*env)->GetArrayLength(env, base_point) == 33);
36753 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
36754 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36755 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
36756 return (int64_t)ret_conv;
36759 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) {
36760 unsigned char per_commitment_secret_arr[32];
36761 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
36762 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
36763 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
36764 unsigned char countersignatory_revocation_base_secret_arr[32];
36765 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
36766 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
36767 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
36768 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36769 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
36770 return (int64_t)ret_conv;
36773 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) {
36774 LDKPublicKey per_commitment_point_ref;
36775 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36776 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36777 LDKPublicKey countersignatory_revocation_base_point_ref;
36778 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
36779 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
36780 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36781 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
36782 return (int64_t)ret_conv;
36785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36786 LDKTxCreationKeys this_obj_conv;
36787 this_obj_conv.inner = (void*)(this_obj & (~1));
36788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36790 TxCreationKeys_free(this_obj_conv);
36793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36794 LDKTxCreationKeys this_ptr_conv;
36795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36796 this_ptr_conv.is_owned = false;
36797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36798 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36799 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
36803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36804 LDKTxCreationKeys this_ptr_conv;
36805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36806 this_ptr_conv.is_owned = false;
36807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36808 LDKPublicKey val_ref;
36809 CHECK((*env)->GetArrayLength(env, val) == 33);
36810 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36811 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
36814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36815 LDKTxCreationKeys this_ptr_conv;
36816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36817 this_ptr_conv.is_owned = false;
36818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36819 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36820 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
36824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36825 LDKTxCreationKeys this_ptr_conv;
36826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36827 this_ptr_conv.is_owned = false;
36828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36829 LDKPublicKey val_ref;
36830 CHECK((*env)->GetArrayLength(env, val) == 33);
36831 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36832 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
36835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36836 LDKTxCreationKeys this_ptr_conv;
36837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36838 this_ptr_conv.is_owned = false;
36839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36840 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36841 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
36845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36846 LDKTxCreationKeys this_ptr_conv;
36847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36848 this_ptr_conv.is_owned = false;
36849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36850 LDKPublicKey val_ref;
36851 CHECK((*env)->GetArrayLength(env, val) == 33);
36852 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36853 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
36856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36857 LDKTxCreationKeys this_ptr_conv;
36858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36859 this_ptr_conv.is_owned = false;
36860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36861 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36862 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
36866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36867 LDKTxCreationKeys this_ptr_conv;
36868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36869 this_ptr_conv.is_owned = false;
36870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36871 LDKPublicKey val_ref;
36872 CHECK((*env)->GetArrayLength(env, val) == 33);
36873 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36874 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
36877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36878 LDKTxCreationKeys this_ptr_conv;
36879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36880 this_ptr_conv.is_owned = false;
36881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36882 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36883 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
36887 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) {
36888 LDKTxCreationKeys this_ptr_conv;
36889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36890 this_ptr_conv.is_owned = false;
36891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36892 LDKPublicKey val_ref;
36893 CHECK((*env)->GetArrayLength(env, val) == 33);
36894 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36895 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
36898 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) {
36899 LDKPublicKey per_commitment_point_arg_ref;
36900 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
36901 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
36902 LDKPublicKey revocation_key_arg_ref;
36903 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
36904 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
36905 LDKPublicKey broadcaster_htlc_key_arg_ref;
36906 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
36907 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
36908 LDKPublicKey countersignatory_htlc_key_arg_ref;
36909 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
36910 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
36911 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
36912 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
36913 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
36914 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);
36915 int64_t ret_ref = 0;
36916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36919 ret_ref = (uintptr_t)ret_var.inner;
36920 if (ret_var.is_owned) {
36926 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
36927 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
36928 int64_t ret_ref = 0;
36929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36932 ret_ref = (uintptr_t)ret_var.inner;
36933 if (ret_var.is_owned) {
36938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36939 LDKTxCreationKeys arg_conv;
36940 arg_conv.inner = (void*)(arg & (~1));
36941 arg_conv.is_owned = false;
36942 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36943 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
36947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36948 LDKTxCreationKeys orig_conv;
36949 orig_conv.inner = (void*)(orig & (~1));
36950 orig_conv.is_owned = false;
36951 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36952 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
36953 int64_t ret_ref = 0;
36954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36957 ret_ref = (uintptr_t)ret_var.inner;
36958 if (ret_var.is_owned) {
36964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
36965 LDKTxCreationKeys obj_conv;
36966 obj_conv.inner = (void*)(obj & (~1));
36967 obj_conv.is_owned = false;
36968 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36969 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
36970 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36971 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36972 CVec_u8Z_free(ret_var);
36976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36977 LDKu8slice ser_ref;
36978 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36979 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36980 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36981 *ret_conv = TxCreationKeys_read(ser_ref);
36982 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36983 return (int64_t)ret_conv;
36986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36987 LDKChannelPublicKeys this_obj_conv;
36988 this_obj_conv.inner = (void*)(this_obj & (~1));
36989 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36991 ChannelPublicKeys_free(this_obj_conv);
36994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36995 LDKChannelPublicKeys this_ptr_conv;
36996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36997 this_ptr_conv.is_owned = false;
36998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36999 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37000 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
37004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37005 LDKChannelPublicKeys this_ptr_conv;
37006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37007 this_ptr_conv.is_owned = false;
37008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37009 LDKPublicKey val_ref;
37010 CHECK((*env)->GetArrayLength(env, val) == 33);
37011 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37012 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37016 LDKChannelPublicKeys 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37021 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
37025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37026 LDKChannelPublicKeys this_ptr_conv;
37027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37028 this_ptr_conv.is_owned = false;
37029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37030 LDKPublicKey val_ref;
37031 CHECK((*env)->GetArrayLength(env, val) == 33);
37032 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37033 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37037 LDKChannelPublicKeys this_ptr_conv;
37038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37039 this_ptr_conv.is_owned = false;
37040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37041 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37042 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
37046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37047 LDKChannelPublicKeys this_ptr_conv;
37048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37049 this_ptr_conv.is_owned = false;
37050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37051 LDKPublicKey val_ref;
37052 CHECK((*env)->GetArrayLength(env, val) == 33);
37053 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37054 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37058 LDKChannelPublicKeys this_ptr_conv;
37059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37060 this_ptr_conv.is_owned = false;
37061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37062 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37063 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
37067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37068 LDKChannelPublicKeys this_ptr_conv;
37069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37070 this_ptr_conv.is_owned = false;
37071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37072 LDKPublicKey val_ref;
37073 CHECK((*env)->GetArrayLength(env, val) == 33);
37074 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37075 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37079 LDKChannelPublicKeys this_ptr_conv;
37080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37081 this_ptr_conv.is_owned = false;
37082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37083 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37084 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
37088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37089 LDKChannelPublicKeys this_ptr_conv;
37090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37091 this_ptr_conv.is_owned = false;
37092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37093 LDKPublicKey val_ref;
37094 CHECK((*env)->GetArrayLength(env, val) == 33);
37095 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37096 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
37099 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) {
37100 LDKPublicKey funding_pubkey_arg_ref;
37101 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
37102 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
37103 LDKPublicKey revocation_basepoint_arg_ref;
37104 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
37105 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
37106 LDKPublicKey payment_point_arg_ref;
37107 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
37108 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
37109 LDKPublicKey delayed_payment_basepoint_arg_ref;
37110 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
37111 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
37112 LDKPublicKey htlc_basepoint_arg_ref;
37113 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
37114 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
37115 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);
37116 int64_t ret_ref = 0;
37117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37120 ret_ref = (uintptr_t)ret_var.inner;
37121 if (ret_var.is_owned) {
37127 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
37128 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
37129 int64_t ret_ref = 0;
37130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37133 ret_ref = (uintptr_t)ret_var.inner;
37134 if (ret_var.is_owned) {
37139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37140 LDKChannelPublicKeys arg_conv;
37141 arg_conv.inner = (void*)(arg & (~1));
37142 arg_conv.is_owned = false;
37143 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37144 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
37148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37149 LDKChannelPublicKeys orig_conv;
37150 orig_conv.inner = (void*)(orig & (~1));
37151 orig_conv.is_owned = false;
37152 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37153 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
37154 int64_t ret_ref = 0;
37155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37158 ret_ref = (uintptr_t)ret_var.inner;
37159 if (ret_var.is_owned) {
37165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37166 LDKChannelPublicKeys obj_conv;
37167 obj_conv.inner = (void*)(obj & (~1));
37168 obj_conv.is_owned = false;
37169 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37170 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
37171 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37172 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37173 CVec_u8Z_free(ret_var);
37177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37178 LDKu8slice ser_ref;
37179 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37180 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37181 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37182 *ret_conv = ChannelPublicKeys_read(ser_ref);
37183 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37184 return (int64_t)ret_conv;
37187 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) {
37188 LDKPublicKey per_commitment_point_ref;
37189 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37190 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37191 LDKPublicKey broadcaster_delayed_payment_base_ref;
37192 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
37193 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
37194 LDKPublicKey broadcaster_htlc_base_ref;
37195 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
37196 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
37197 LDKPublicKey countersignatory_revocation_base_ref;
37198 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
37199 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
37200 LDKPublicKey countersignatory_htlc_base_ref;
37201 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
37202 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
37203 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37204 *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);
37205 return (int64_t)ret_conv;
37208 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) {
37209 LDKPublicKey per_commitment_point_ref;
37210 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37211 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37212 LDKChannelPublicKeys broadcaster_keys_conv;
37213 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
37214 broadcaster_keys_conv.is_owned = false;
37215 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37216 LDKChannelPublicKeys countersignatory_keys_conv;
37217 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
37218 countersignatory_keys_conv.is_owned = false;
37219 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37220 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37221 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
37222 return (int64_t)ret_conv;
37225 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) {
37226 LDKPublicKey revocation_key_ref;
37227 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37228 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37229 LDKPublicKey broadcaster_delayed_payment_key_ref;
37230 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37231 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37232 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
37233 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37234 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37235 CVec_u8Z_free(ret_var);
37239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37240 LDKHTLCOutputInCommitment this_obj_conv;
37241 this_obj_conv.inner = (void*)(this_obj & (~1));
37242 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37244 HTLCOutputInCommitment_free(this_obj_conv);
37247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
37248 LDKHTLCOutputInCommitment this_ptr_conv;
37249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37250 this_ptr_conv.is_owned = false;
37251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37252 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
37256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37257 LDKHTLCOutputInCommitment this_ptr_conv;
37258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37259 this_ptr_conv.is_owned = false;
37260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37261 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
37264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37265 LDKHTLCOutputInCommitment this_ptr_conv;
37266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37267 this_ptr_conv.is_owned = false;
37268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37269 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
37273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37274 LDKHTLCOutputInCommitment this_ptr_conv;
37275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37276 this_ptr_conv.is_owned = false;
37277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37278 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
37281 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
37282 LDKHTLCOutputInCommitment this_ptr_conv;
37283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37284 this_ptr_conv.is_owned = false;
37285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37286 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
37290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37291 LDKHTLCOutputInCommitment this_ptr_conv;
37292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37293 this_ptr_conv.is_owned = false;
37294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37295 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
37298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
37299 LDKHTLCOutputInCommitment this_ptr_conv;
37300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37301 this_ptr_conv.is_owned = false;
37302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37303 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
37308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37309 LDKHTLCOutputInCommitment this_ptr_conv;
37310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37311 this_ptr_conv.is_owned = false;
37312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37313 LDKThirtyTwoBytes val_ref;
37314 CHECK((*env)->GetArrayLength(env, val) == 32);
37315 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37316 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
37319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
37320 LDKHTLCOutputInCommitment this_ptr_conv;
37321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37322 this_ptr_conv.is_owned = false;
37323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37324 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37325 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
37326 int64_t ret_ref = (uintptr_t)ret_copy;
37330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37331 LDKHTLCOutputInCommitment this_ptr_conv;
37332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37333 this_ptr_conv.is_owned = false;
37334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37335 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37336 CHECK_ACCESS(val_ptr);
37337 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37338 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
37339 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
37342 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) {
37343 LDKThirtyTwoBytes payment_hash_arg_ref;
37344 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
37345 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
37346 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
37347 CHECK_ACCESS(transaction_output_index_arg_ptr);
37348 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
37349 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
37350 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
37351 int64_t ret_ref = 0;
37352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37355 ret_ref = (uintptr_t)ret_var.inner;
37356 if (ret_var.is_owned) {
37362 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
37363 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
37364 int64_t ret_ref = 0;
37365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37368 ret_ref = (uintptr_t)ret_var.inner;
37369 if (ret_var.is_owned) {
37374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37375 LDKHTLCOutputInCommitment arg_conv;
37376 arg_conv.inner = (void*)(arg & (~1));
37377 arg_conv.is_owned = false;
37378 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37379 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
37383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37384 LDKHTLCOutputInCommitment orig_conv;
37385 orig_conv.inner = (void*)(orig & (~1));
37386 orig_conv.is_owned = false;
37387 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37388 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
37389 int64_t ret_ref = 0;
37390 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37391 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37393 ret_ref = (uintptr_t)ret_var.inner;
37394 if (ret_var.is_owned) {
37400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
37401 LDKHTLCOutputInCommitment obj_conv;
37402 obj_conv.inner = (void*)(obj & (~1));
37403 obj_conv.is_owned = false;
37404 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37405 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
37406 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37407 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37408 CVec_u8Z_free(ret_var);
37412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37413 LDKu8slice ser_ref;
37414 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37415 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37416 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37417 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
37418 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37419 return (int64_t)ret_conv;
37422 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) {
37423 LDKHTLCOutputInCommitment htlc_conv;
37424 htlc_conv.inner = (void*)(htlc & (~1));
37425 htlc_conv.is_owned = false;
37426 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37427 LDKTxCreationKeys keys_conv;
37428 keys_conv.inner = (void*)(keys & (~1));
37429 keys_conv.is_owned = false;
37430 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
37431 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
37432 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37433 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37434 CVec_u8Z_free(ret_var);
37438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
37439 LDKPublicKey broadcaster_ref;
37440 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
37441 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
37442 LDKPublicKey countersignatory_ref;
37443 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
37444 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
37445 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
37446 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37447 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37448 CVec_u8Z_free(ret_var);
37452 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) {
37453 unsigned char commitment_txid_arr[32];
37454 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
37455 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
37456 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
37457 LDKHTLCOutputInCommitment htlc_conv;
37458 htlc_conv.inner = (void*)(htlc & (~1));
37459 htlc_conv.is_owned = false;
37460 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37461 LDKPublicKey broadcaster_delayed_payment_key_ref;
37462 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37463 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37464 LDKPublicKey revocation_key_ref;
37465 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37466 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37467 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);
37468 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37469 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37470 Transaction_free(ret_var);
37474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
37475 LDKPublicKey funding_pubkey_ref;
37476 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
37477 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
37478 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
37479 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37480 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37481 CVec_u8Z_free(ret_var);
37485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37486 LDKChannelTransactionParameters this_obj_conv;
37487 this_obj_conv.inner = (void*)(this_obj & (~1));
37488 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37490 ChannelTransactionParameters_free(this_obj_conv);
37493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
37494 LDKChannelTransactionParameters this_ptr_conv;
37495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37496 this_ptr_conv.is_owned = false;
37497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37498 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
37499 int64_t ret_ref = 0;
37500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37503 ret_ref = (uintptr_t)ret_var.inner;
37504 if (ret_var.is_owned) {
37510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37511 LDKChannelTransactionParameters this_ptr_conv;
37512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37513 this_ptr_conv.is_owned = false;
37514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37515 LDKChannelPublicKeys val_conv;
37516 val_conv.inner = (void*)(val & (~1));
37517 val_conv.is_owned = (val & 1) || (val == 0);
37518 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37519 val_conv = ChannelPublicKeys_clone(&val_conv);
37520 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
37523 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37524 LDKChannelTransactionParameters this_ptr_conv;
37525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37526 this_ptr_conv.is_owned = false;
37527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37528 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
37532 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) {
37533 LDKChannelTransactionParameters this_ptr_conv;
37534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37535 this_ptr_conv.is_owned = false;
37536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37537 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
37540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
37541 LDKChannelTransactionParameters this_ptr_conv;
37542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37543 this_ptr_conv.is_owned = false;
37544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37545 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
37549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37550 LDKChannelTransactionParameters this_ptr_conv;
37551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37552 this_ptr_conv.is_owned = false;
37553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37554 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
37557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
37558 LDKChannelTransactionParameters this_ptr_conv;
37559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37560 this_ptr_conv.is_owned = false;
37561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37562 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
37563 int64_t ret_ref = 0;
37564 if ((uintptr_t)ret_var.inner > 4096) {
37565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37568 ret_ref = (uintptr_t)ret_var.inner;
37569 if (ret_var.is_owned) {
37576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37577 LDKChannelTransactionParameters this_ptr_conv;
37578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37579 this_ptr_conv.is_owned = false;
37580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37581 LDKCounterpartyChannelTransactionParameters val_conv;
37582 val_conv.inner = (void*)(val & (~1));
37583 val_conv.is_owned = (val & 1) || (val == 0);
37584 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37585 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
37586 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
37589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37590 LDKChannelTransactionParameters this_ptr_conv;
37591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37592 this_ptr_conv.is_owned = false;
37593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37594 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
37595 int64_t ret_ref = 0;
37596 if ((uintptr_t)ret_var.inner > 4096) {
37597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37600 ret_ref = (uintptr_t)ret_var.inner;
37601 if (ret_var.is_owned) {
37608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37609 LDKChannelTransactionParameters this_ptr_conv;
37610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37611 this_ptr_conv.is_owned = false;
37612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37613 LDKOutPoint val_conv;
37614 val_conv.inner = (void*)(val & (~1));
37615 val_conv.is_owned = (val & 1) || (val == 0);
37616 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37617 val_conv = OutPoint_clone(&val_conv);
37618 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
37621 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
37622 LDKChannelTransactionParameters this_ptr_conv;
37623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37624 this_ptr_conv.is_owned = false;
37625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37626 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
37630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
37631 LDKChannelTransactionParameters this_ptr_conv;
37632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37633 this_ptr_conv.is_owned = false;
37634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37635 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
37636 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
37639 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) {
37640 LDKChannelPublicKeys holder_pubkeys_arg_conv;
37641 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
37642 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
37643 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
37644 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
37645 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
37646 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
37647 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
37648 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
37649 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
37650 LDKOutPoint funding_outpoint_arg_conv;
37651 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
37652 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
37653 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
37654 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
37655 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
37656 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);
37657 int64_t ret_ref = 0;
37658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37661 ret_ref = (uintptr_t)ret_var.inner;
37662 if (ret_var.is_owned) {
37668 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
37669 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
37670 int64_t ret_ref = 0;
37671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37674 ret_ref = (uintptr_t)ret_var.inner;
37675 if (ret_var.is_owned) {
37680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37681 LDKChannelTransactionParameters arg_conv;
37682 arg_conv.inner = (void*)(arg & (~1));
37683 arg_conv.is_owned = false;
37684 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37685 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
37689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37690 LDKChannelTransactionParameters orig_conv;
37691 orig_conv.inner = (void*)(orig & (~1));
37692 orig_conv.is_owned = false;
37693 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37694 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
37695 int64_t ret_ref = 0;
37696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37699 ret_ref = (uintptr_t)ret_var.inner;
37700 if (ret_var.is_owned) {
37706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37707 LDKCounterpartyChannelTransactionParameters this_obj_conv;
37708 this_obj_conv.inner = (void*)(this_obj & (~1));
37709 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37711 CounterpartyChannelTransactionParameters_free(this_obj_conv);
37714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
37715 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37717 this_ptr_conv.is_owned = false;
37718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37719 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
37720 int64_t ret_ref = 0;
37721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37724 ret_ref = (uintptr_t)ret_var.inner;
37725 if (ret_var.is_owned) {
37731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37732 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37734 this_ptr_conv.is_owned = false;
37735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37736 LDKChannelPublicKeys val_conv;
37737 val_conv.inner = (void*)(val & (~1));
37738 val_conv.is_owned = (val & 1) || (val == 0);
37739 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37740 val_conv = ChannelPublicKeys_clone(&val_conv);
37741 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
37744 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37745 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37747 this_ptr_conv.is_owned = false;
37748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37749 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
37753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
37754 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37756 this_ptr_conv.is_owned = false;
37757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37758 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
37761 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) {
37762 LDKChannelPublicKeys pubkeys_arg_conv;
37763 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
37764 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
37765 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
37766 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
37767 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
37768 int64_t ret_ref = 0;
37769 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37770 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37772 ret_ref = (uintptr_t)ret_var.inner;
37773 if (ret_var.is_owned) {
37779 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
37780 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
37781 int64_t ret_ref = 0;
37782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37785 ret_ref = (uintptr_t)ret_var.inner;
37786 if (ret_var.is_owned) {
37791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37792 LDKCounterpartyChannelTransactionParameters arg_conv;
37793 arg_conv.inner = (void*)(arg & (~1));
37794 arg_conv.is_owned = false;
37795 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37796 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
37800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37801 LDKCounterpartyChannelTransactionParameters orig_conv;
37802 orig_conv.inner = (void*)(orig & (~1));
37803 orig_conv.is_owned = false;
37804 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37805 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
37806 int64_t ret_ref = 0;
37807 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37808 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37810 ret_ref = (uintptr_t)ret_var.inner;
37811 if (ret_var.is_owned) {
37817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
37818 LDKChannelTransactionParameters this_arg_conv;
37819 this_arg_conv.inner = (void*)(this_arg & (~1));
37820 this_arg_conv.is_owned = false;
37821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37822 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
37826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37827 LDKChannelTransactionParameters this_arg_conv;
37828 this_arg_conv.inner = (void*)(this_arg & (~1));
37829 this_arg_conv.is_owned = false;
37830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37831 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
37832 int64_t ret_ref = 0;
37833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37836 ret_ref = (uintptr_t)ret_var.inner;
37837 if (ret_var.is_owned) {
37843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37844 LDKChannelTransactionParameters this_arg_conv;
37845 this_arg_conv.inner = (void*)(this_arg & (~1));
37846 this_arg_conv.is_owned = false;
37847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37848 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
37849 int64_t ret_ref = 0;
37850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37853 ret_ref = (uintptr_t)ret_var.inner;
37854 if (ret_var.is_owned) {
37860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37861 LDKCounterpartyChannelTransactionParameters obj_conv;
37862 obj_conv.inner = (void*)(obj & (~1));
37863 obj_conv.is_owned = false;
37864 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37865 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
37866 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37867 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37868 CVec_u8Z_free(ret_var);
37872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37873 LDKu8slice ser_ref;
37874 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37875 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37876 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37877 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
37878 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37879 return (int64_t)ret_conv;
37882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37883 LDKChannelTransactionParameters obj_conv;
37884 obj_conv.inner = (void*)(obj & (~1));
37885 obj_conv.is_owned = false;
37886 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37887 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
37888 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37889 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37890 CVec_u8Z_free(ret_var);
37894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37895 LDKu8slice ser_ref;
37896 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37897 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37898 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37899 *ret_conv = ChannelTransactionParameters_read(ser_ref);
37900 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37901 return (int64_t)ret_conv;
37904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37905 LDKDirectedChannelTransactionParameters this_obj_conv;
37906 this_obj_conv.inner = (void*)(this_obj & (~1));
37907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37909 DirectedChannelTransactionParameters_free(this_obj_conv);
37912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37913 LDKDirectedChannelTransactionParameters 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 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
37918 int64_t ret_ref = 0;
37919 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37920 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37922 ret_ref = (uintptr_t)ret_var.inner;
37923 if (ret_var.is_owned) {
37929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37930 LDKDirectedChannelTransactionParameters this_arg_conv;
37931 this_arg_conv.inner = (void*)(this_arg & (~1));
37932 this_arg_conv.is_owned = false;
37933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37934 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
37935 int64_t ret_ref = 0;
37936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37939 ret_ref = (uintptr_t)ret_var.inner;
37940 if (ret_var.is_owned) {
37946 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
37947 LDKDirectedChannelTransactionParameters this_arg_conv;
37948 this_arg_conv.inner = (void*)(this_arg & (~1));
37949 this_arg_conv.is_owned = false;
37950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37951 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
37955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
37956 LDKDirectedChannelTransactionParameters this_arg_conv;
37957 this_arg_conv.inner = (void*)(this_arg & (~1));
37958 this_arg_conv.is_owned = false;
37959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37960 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
37964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
37965 LDKDirectedChannelTransactionParameters this_arg_conv;
37966 this_arg_conv.inner = (void*)(this_arg & (~1));
37967 this_arg_conv.is_owned = false;
37968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37969 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
37970 int64_t ret_ref = 0;
37971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37974 ret_ref = (uintptr_t)ret_var.inner;
37975 if (ret_var.is_owned) {
37981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
37982 LDKDirectedChannelTransactionParameters this_arg_conv;
37983 this_arg_conv.inner = (void*)(this_arg & (~1));
37984 this_arg_conv.is_owned = false;
37985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37986 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
37990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37991 LDKHolderCommitmentTransaction this_obj_conv;
37992 this_obj_conv.inner = (void*)(this_obj & (~1));
37993 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37995 HolderCommitmentTransaction_free(this_obj_conv);
37998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
37999 LDKHolderCommitmentTransaction this_ptr_conv;
38000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38001 this_ptr_conv.is_owned = false;
38002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38003 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38004 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
38008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38009 LDKHolderCommitmentTransaction this_ptr_conv;
38010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38011 this_ptr_conv.is_owned = false;
38012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38013 LDKSignature val_ref;
38014 CHECK((*env)->GetArrayLength(env, val) == 64);
38015 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38016 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
38020 LDKHolderCommitmentTransaction this_ptr_conv;
38021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38022 this_ptr_conv.is_owned = false;
38023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38024 LDKCVec_SignatureZ val_constr;
38025 val_constr.datalen = (*env)->GetArrayLength(env, val);
38026 if (val_constr.datalen > 0)
38027 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38029 val_constr.data = NULL;
38030 for (size_t i = 0; i < val_constr.datalen; i++) {
38031 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
38032 LDKSignature val_conv_8_ref;
38033 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
38034 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
38035 val_constr.data[i] = val_conv_8_ref;
38037 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38040 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38041 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38042 int64_t ret_ref = 0;
38043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38046 ret_ref = (uintptr_t)ret_var.inner;
38047 if (ret_var.is_owned) {
38052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38053 LDKHolderCommitmentTransaction arg_conv;
38054 arg_conv.inner = (void*)(arg & (~1));
38055 arg_conv.is_owned = false;
38056 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38057 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38062 LDKHolderCommitmentTransaction orig_conv;
38063 orig_conv.inner = (void*)(orig & (~1));
38064 orig_conv.is_owned = false;
38065 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38066 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38067 int64_t ret_ref = 0;
38068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38071 ret_ref = (uintptr_t)ret_var.inner;
38072 if (ret_var.is_owned) {
38078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38079 LDKHolderCommitmentTransaction obj_conv;
38080 obj_conv.inner = (void*)(obj & (~1));
38081 obj_conv.is_owned = false;
38082 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38083 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
38084 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38085 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38086 CVec_u8Z_free(ret_var);
38090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38091 LDKu8slice ser_ref;
38092 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38093 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38094 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
38095 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
38096 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38097 return (int64_t)ret_conv;
38100 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) {
38101 LDKCommitmentTransaction commitment_tx_conv;
38102 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
38103 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
38104 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
38105 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
38106 LDKSignature counterparty_sig_ref;
38107 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
38108 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
38109 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
38110 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
38111 if (counterparty_htlc_sigs_constr.datalen > 0)
38112 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38114 counterparty_htlc_sigs_constr.data = NULL;
38115 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
38116 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
38117 LDKSignature counterparty_htlc_sigs_conv_8_ref;
38118 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
38119 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
38120 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
38122 LDKPublicKey holder_funding_key_ref;
38123 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
38124 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
38125 LDKPublicKey counterparty_funding_key_ref;
38126 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
38127 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
38128 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
38129 int64_t ret_ref = 0;
38130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38133 ret_ref = (uintptr_t)ret_var.inner;
38134 if (ret_var.is_owned) {
38140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38141 LDKBuiltCommitmentTransaction this_obj_conv;
38142 this_obj_conv.inner = (void*)(this_obj & (~1));
38143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38145 BuiltCommitmentTransaction_free(this_obj_conv);
38148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
38149 LDKBuiltCommitmentTransaction this_ptr_conv;
38150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38151 this_ptr_conv.is_owned = false;
38152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38153 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
38154 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38155 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38156 Transaction_free(ret_var);
38160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38161 LDKBuiltCommitmentTransaction this_ptr_conv;
38162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38163 this_ptr_conv.is_owned = false;
38164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38165 LDKTransaction val_ref;
38166 val_ref.datalen = (*env)->GetArrayLength(env, val);
38167 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
38168 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
38169 val_ref.data_is_owned = true;
38170 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
38173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38174 LDKBuiltCommitmentTransaction this_ptr_conv;
38175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38176 this_ptr_conv.is_owned = false;
38177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38178 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38179 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
38183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38184 LDKBuiltCommitmentTransaction this_ptr_conv;
38185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38186 this_ptr_conv.is_owned = false;
38187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38188 LDKThirtyTwoBytes val_ref;
38189 CHECK((*env)->GetArrayLength(env, val) == 32);
38190 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38191 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
38194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
38195 LDKTransaction transaction_arg_ref;
38196 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
38197 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
38198 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
38199 transaction_arg_ref.data_is_owned = true;
38200 LDKThirtyTwoBytes txid_arg_ref;
38201 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38202 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38203 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
38204 int64_t ret_ref = 0;
38205 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38206 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38208 ret_ref = (uintptr_t)ret_var.inner;
38209 if (ret_var.is_owned) {
38215 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
38216 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
38217 int64_t ret_ref = 0;
38218 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38219 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38221 ret_ref = (uintptr_t)ret_var.inner;
38222 if (ret_var.is_owned) {
38227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38228 LDKBuiltCommitmentTransaction arg_conv;
38229 arg_conv.inner = (void*)(arg & (~1));
38230 arg_conv.is_owned = false;
38231 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38232 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
38236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38237 LDKBuiltCommitmentTransaction orig_conv;
38238 orig_conv.inner = (void*)(orig & (~1));
38239 orig_conv.is_owned = false;
38240 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38241 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
38242 int64_t ret_ref = 0;
38243 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38244 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38246 ret_ref = (uintptr_t)ret_var.inner;
38247 if (ret_var.is_owned) {
38253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38254 LDKBuiltCommitmentTransaction obj_conv;
38255 obj_conv.inner = (void*)(obj & (~1));
38256 obj_conv.is_owned = false;
38257 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38258 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
38259 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38260 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38261 CVec_u8Z_free(ret_var);
38265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38266 LDKu8slice ser_ref;
38267 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38268 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38269 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
38270 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
38271 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38272 return (int64_t)ret_conv;
38275 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) {
38276 LDKBuiltCommitmentTransaction this_arg_conv;
38277 this_arg_conv.inner = (void*)(this_arg & (~1));
38278 this_arg_conv.is_owned = false;
38279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38280 LDKu8slice funding_redeemscript_ref;
38281 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38282 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38283 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38284 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38285 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38289 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) {
38290 LDKBuiltCommitmentTransaction this_arg_conv;
38291 this_arg_conv.inner = (void*)(this_arg & (~1));
38292 this_arg_conv.is_owned = false;
38293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38294 unsigned char funding_key_arr[32];
38295 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38296 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38297 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38298 LDKu8slice funding_redeemscript_ref;
38299 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38300 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38301 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38302 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38303 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38308 LDKClosingTransaction this_obj_conv;
38309 this_obj_conv.inner = (void*)(this_obj & (~1));
38310 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38312 ClosingTransaction_free(this_obj_conv);
38315 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
38316 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
38317 int64_t ret_ref = 0;
38318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38321 ret_ref = (uintptr_t)ret_var.inner;
38322 if (ret_var.is_owned) {
38327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38328 LDKClosingTransaction arg_conv;
38329 arg_conv.inner = (void*)(arg & (~1));
38330 arg_conv.is_owned = false;
38331 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38332 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
38336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38337 LDKClosingTransaction orig_conv;
38338 orig_conv.inner = (void*)(orig & (~1));
38339 orig_conv.is_owned = false;
38340 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38341 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
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) {
38353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
38354 LDKClosingTransaction o_conv;
38355 o_conv.inner = (void*)(o & (~1));
38356 o_conv.is_owned = false;
38357 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38358 int64_t ret_val = ClosingTransaction_hash(&o_conv);
38362 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) {
38363 LDKCVec_u8Z to_holder_script_ref;
38364 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
38365 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
38366 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
38367 LDKCVec_u8Z to_counterparty_script_ref;
38368 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
38369 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
38370 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
38371 LDKOutPoint funding_outpoint_conv;
38372 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
38373 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
38374 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38375 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38376 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
38377 int64_t ret_ref = 0;
38378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38381 ret_ref = (uintptr_t)ret_var.inner;
38382 if (ret_var.is_owned) {
38388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
38389 LDKClosingTransaction this_arg_conv;
38390 this_arg_conv.inner = (void*)(this_arg & (~1));
38391 this_arg_conv.is_owned = false;
38392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38393 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
38394 int64_t ret_ref = 0;
38395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38398 ret_ref = (uintptr_t)ret_var.inner;
38399 if (ret_var.is_owned) {
38405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
38406 LDKClosingTransaction this_arg_conv;
38407 this_arg_conv.inner = (void*)(this_arg & (~1));
38408 this_arg_conv.is_owned = false;
38409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38410 LDKOutPoint funding_outpoint_conv;
38411 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
38412 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
38413 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38414 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38415 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
38416 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
38417 return (int64_t)ret_conv;
38420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38421 LDKClosingTransaction this_arg_conv;
38422 this_arg_conv.inner = (void*)(this_arg & (~1));
38423 this_arg_conv.is_owned = false;
38424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38425 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
38429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38430 LDKClosingTransaction this_arg_conv;
38431 this_arg_conv.inner = (void*)(this_arg & (~1));
38432 this_arg_conv.is_owned = false;
38433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38434 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
38438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
38439 LDKClosingTransaction this_arg_conv;
38440 this_arg_conv.inner = (void*)(this_arg & (~1));
38441 this_arg_conv.is_owned = false;
38442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38443 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
38444 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38445 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
38450 LDKClosingTransaction this_arg_conv;
38451 this_arg_conv.inner = (void*)(this_arg & (~1));
38452 this_arg_conv.is_owned = false;
38453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38454 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
38455 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38456 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38461 LDKTrustedClosingTransaction this_obj_conv;
38462 this_obj_conv.inner = (void*)(this_obj & (~1));
38463 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38465 TrustedClosingTransaction_free(this_obj_conv);
38468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
38469 LDKTrustedClosingTransaction this_arg_conv;
38470 this_arg_conv.inner = (void*)(this_arg & (~1));
38471 this_arg_conv.is_owned = false;
38472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38473 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
38474 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38475 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38476 Transaction_free(ret_var);
38480 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) {
38481 LDKTrustedClosingTransaction this_arg_conv;
38482 this_arg_conv.inner = (void*)(this_arg & (~1));
38483 this_arg_conv.is_owned = false;
38484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38485 LDKu8slice funding_redeemscript_ref;
38486 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38487 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38488 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38490 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38494 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) {
38495 LDKTrustedClosingTransaction this_arg_conv;
38496 this_arg_conv.inner = (void*)(this_arg & (~1));
38497 this_arg_conv.is_owned = false;
38498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38499 unsigned char funding_key_arr[32];
38500 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38501 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38502 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38503 LDKu8slice funding_redeemscript_ref;
38504 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38505 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38506 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38507 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38508 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38513 LDKCommitmentTransaction this_obj_conv;
38514 this_obj_conv.inner = (void*)(this_obj & (~1));
38515 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38517 CommitmentTransaction_free(this_obj_conv);
38520 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
38521 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
38522 int64_t ret_ref = 0;
38523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38526 ret_ref = (uintptr_t)ret_var.inner;
38527 if (ret_var.is_owned) {
38532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38533 LDKCommitmentTransaction arg_conv;
38534 arg_conv.inner = (void*)(arg & (~1));
38535 arg_conv.is_owned = false;
38536 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38537 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
38541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38542 LDKCommitmentTransaction orig_conv;
38543 orig_conv.inner = (void*)(orig & (~1));
38544 orig_conv.is_owned = false;
38545 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38546 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
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 int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38559 LDKCommitmentTransaction obj_conv;
38560 obj_conv.inner = (void*)(obj & (~1));
38561 obj_conv.is_owned = false;
38562 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38563 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
38564 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38565 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38566 CVec_u8Z_free(ret_var);
38570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38571 LDKu8slice ser_ref;
38572 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38573 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38574 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
38575 *ret_conv = CommitmentTransaction_read(ser_ref);
38576 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38577 return (int64_t)ret_conv;
38580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
38581 LDKCommitmentTransaction this_arg_conv;
38582 this_arg_conv.inner = (void*)(this_arg & (~1));
38583 this_arg_conv.is_owned = false;
38584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38585 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
38589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38590 LDKCommitmentTransaction this_arg_conv;
38591 this_arg_conv.inner = (void*)(this_arg & (~1));
38592 this_arg_conv.is_owned = false;
38593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38594 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
38598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38599 LDKCommitmentTransaction this_arg_conv;
38600 this_arg_conv.inner = (void*)(this_arg & (~1));
38601 this_arg_conv.is_owned = false;
38602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38603 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
38607 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
38608 LDKCommitmentTransaction this_arg_conv;
38609 this_arg_conv.inner = (void*)(this_arg & (~1));
38610 this_arg_conv.is_owned = false;
38611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38612 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
38616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
38617 LDKCommitmentTransaction this_arg_conv;
38618 this_arg_conv.inner = (void*)(this_arg & (~1));
38619 this_arg_conv.is_owned = false;
38620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38621 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
38622 int64_t ret_ref = 0;
38623 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38624 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38626 ret_ref = (uintptr_t)ret_var.inner;
38627 if (ret_var.is_owned) {
38633 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) {
38634 LDKCommitmentTransaction this_arg_conv;
38635 this_arg_conv.inner = (void*)(this_arg & (~1));
38636 this_arg_conv.is_owned = false;
38637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38638 LDKDirectedChannelTransactionParameters channel_parameters_conv;
38639 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
38640 channel_parameters_conv.is_owned = false;
38641 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38642 LDKChannelPublicKeys broadcaster_keys_conv;
38643 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
38644 broadcaster_keys_conv.is_owned = false;
38645 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38646 LDKChannelPublicKeys countersignatory_keys_conv;
38647 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
38648 countersignatory_keys_conv.is_owned = false;
38649 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38650 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
38651 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
38652 return (int64_t)ret_conv;
38655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38656 LDKTrustedCommitmentTransaction this_obj_conv;
38657 this_obj_conv.inner = (void*)(this_obj & (~1));
38658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38660 TrustedCommitmentTransaction_free(this_obj_conv);
38663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
38664 LDKTrustedCommitmentTransaction 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38669 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
38673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
38674 LDKTrustedCommitmentTransaction this_arg_conv;
38675 this_arg_conv.inner = (void*)(this_arg & (~1));
38676 this_arg_conv.is_owned = false;
38677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38678 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
38679 int64_t ret_ref = 0;
38680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38683 ret_ref = (uintptr_t)ret_var.inner;
38684 if (ret_var.is_owned) {
38690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
38691 LDKTrustedCommitmentTransaction this_arg_conv;
38692 this_arg_conv.inner = (void*)(this_arg & (~1));
38693 this_arg_conv.is_owned = false;
38694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38695 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
38696 int64_t ret_ref = 0;
38697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38700 ret_ref = (uintptr_t)ret_var.inner;
38701 if (ret_var.is_owned) {
38707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38708 LDKTrustedCommitmentTransaction this_arg_conv;
38709 this_arg_conv.inner = (void*)(this_arg & (~1));
38710 this_arg_conv.is_owned = false;
38711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38712 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
38716 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) {
38717 LDKTrustedCommitmentTransaction this_arg_conv;
38718 this_arg_conv.inner = (void*)(this_arg & (~1));
38719 this_arg_conv.is_owned = false;
38720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38721 unsigned char htlc_base_key_arr[32];
38722 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
38723 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
38724 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
38725 LDKDirectedChannelTransactionParameters channel_parameters_conv;
38726 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
38727 channel_parameters_conv.is_owned = false;
38728 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38729 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
38730 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
38731 return (int64_t)ret_conv;
38734 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) {
38735 LDKPublicKey broadcaster_payment_basepoint_ref;
38736 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
38737 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
38738 LDKPublicKey countersignatory_payment_basepoint_ref;
38739 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
38740 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
38741 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
38745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38746 LDKInitFeatures a_conv;
38747 a_conv.inner = (void*)(a & (~1));
38748 a_conv.is_owned = false;
38749 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38750 LDKInitFeatures b_conv;
38751 b_conv.inner = (void*)(b & (~1));
38752 b_conv.is_owned = false;
38753 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38754 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
38758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38759 LDKNodeFeatures a_conv;
38760 a_conv.inner = (void*)(a & (~1));
38761 a_conv.is_owned = false;
38762 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38763 LDKNodeFeatures b_conv;
38764 b_conv.inner = (void*)(b & (~1));
38765 b_conv.is_owned = false;
38766 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38767 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
38771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38772 LDKChannelFeatures a_conv;
38773 a_conv.inner = (void*)(a & (~1));
38774 a_conv.is_owned = false;
38775 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38776 LDKChannelFeatures b_conv;
38777 b_conv.inner = (void*)(b & (~1));
38778 b_conv.is_owned = false;
38779 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38780 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
38784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38785 LDKInvoiceFeatures a_conv;
38786 a_conv.inner = (void*)(a & (~1));
38787 a_conv.is_owned = false;
38788 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38789 LDKInvoiceFeatures b_conv;
38790 b_conv.inner = (void*)(b & (~1));
38791 b_conv.is_owned = false;
38792 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38793 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
38797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38798 LDKChannelTypeFeatures a_conv;
38799 a_conv.inner = (void*)(a & (~1));
38800 a_conv.is_owned = false;
38801 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38802 LDKChannelTypeFeatures b_conv;
38803 b_conv.inner = (void*)(b & (~1));
38804 b_conv.is_owned = false;
38805 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38806 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
38810 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
38811 LDKInitFeatures ret_var = InitFeatures_clone(arg);
38812 int64_t ret_ref = 0;
38813 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38814 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38816 ret_ref = (uintptr_t)ret_var.inner;
38817 if (ret_var.is_owned) {
38822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38823 LDKInitFeatures arg_conv;
38824 arg_conv.inner = (void*)(arg & (~1));
38825 arg_conv.is_owned = false;
38826 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38827 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
38831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38832 LDKInitFeatures orig_conv;
38833 orig_conv.inner = (void*)(orig & (~1));
38834 orig_conv.is_owned = false;
38835 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38836 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
38837 int64_t ret_ref = 0;
38838 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38839 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38841 ret_ref = (uintptr_t)ret_var.inner;
38842 if (ret_var.is_owned) {
38848 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
38849 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
38850 int64_t ret_ref = 0;
38851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38854 ret_ref = (uintptr_t)ret_var.inner;
38855 if (ret_var.is_owned) {
38860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38861 LDKNodeFeatures arg_conv;
38862 arg_conv.inner = (void*)(arg & (~1));
38863 arg_conv.is_owned = false;
38864 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38865 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
38869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38870 LDKNodeFeatures orig_conv;
38871 orig_conv.inner = (void*)(orig & (~1));
38872 orig_conv.is_owned = false;
38873 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38874 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
38875 int64_t ret_ref = 0;
38876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38879 ret_ref = (uintptr_t)ret_var.inner;
38880 if (ret_var.is_owned) {
38886 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
38887 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
38888 int64_t ret_ref = 0;
38889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38892 ret_ref = (uintptr_t)ret_var.inner;
38893 if (ret_var.is_owned) {
38898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38899 LDKChannelFeatures arg_conv;
38900 arg_conv.inner = (void*)(arg & (~1));
38901 arg_conv.is_owned = false;
38902 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38903 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
38907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38908 LDKChannelFeatures orig_conv;
38909 orig_conv.inner = (void*)(orig & (~1));
38910 orig_conv.is_owned = false;
38911 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38912 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
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) {
38924 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
38925 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
38926 int64_t ret_ref = 0;
38927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38930 ret_ref = (uintptr_t)ret_var.inner;
38931 if (ret_var.is_owned) {
38936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38937 LDKInvoiceFeatures arg_conv;
38938 arg_conv.inner = (void*)(arg & (~1));
38939 arg_conv.is_owned = false;
38940 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38941 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
38945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38946 LDKInvoiceFeatures orig_conv;
38947 orig_conv.inner = (void*)(orig & (~1));
38948 orig_conv.is_owned = false;
38949 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38950 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
38951 int64_t ret_ref = 0;
38952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38955 ret_ref = (uintptr_t)ret_var.inner;
38956 if (ret_var.is_owned) {
38962 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
38963 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
38964 int64_t ret_ref = 0;
38965 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38966 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38967 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38968 ret_ref = (uintptr_t)ret_var.inner;
38969 if (ret_var.is_owned) {
38974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38975 LDKChannelTypeFeatures arg_conv;
38976 arg_conv.inner = (void*)(arg & (~1));
38977 arg_conv.is_owned = false;
38978 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38979 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
38983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38984 LDKChannelTypeFeatures orig_conv;
38985 orig_conv.inner = (void*)(orig & (~1));
38986 orig_conv.is_owned = false;
38987 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38988 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
38989 int64_t ret_ref = 0;
38990 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38991 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38993 ret_ref = (uintptr_t)ret_var.inner;
38994 if (ret_var.is_owned) {
39000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39001 LDKInitFeatures this_obj_conv;
39002 this_obj_conv.inner = (void*)(this_obj & (~1));
39003 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39005 InitFeatures_free(this_obj_conv);
39008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39009 LDKNodeFeatures this_obj_conv;
39010 this_obj_conv.inner = (void*)(this_obj & (~1));
39011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39013 NodeFeatures_free(this_obj_conv);
39016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39017 LDKChannelFeatures this_obj_conv;
39018 this_obj_conv.inner = (void*)(this_obj & (~1));
39019 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39021 ChannelFeatures_free(this_obj_conv);
39024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39025 LDKInvoiceFeatures this_obj_conv;
39026 this_obj_conv.inner = (void*)(this_obj & (~1));
39027 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39029 InvoiceFeatures_free(this_obj_conv);
39032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39033 LDKChannelTypeFeatures this_obj_conv;
39034 this_obj_conv.inner = (void*)(this_obj & (~1));
39035 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39037 ChannelTypeFeatures_free(this_obj_conv);
39040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
39041 LDKInitFeatures ret_var = InitFeatures_empty();
39042 int64_t ret_ref = 0;
39043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39046 ret_ref = (uintptr_t)ret_var.inner;
39047 if (ret_var.is_owned) {
39053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
39054 LDKInitFeatures ret_var = InitFeatures_known();
39055 int64_t ret_ref = 0;
39056 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39057 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39059 ret_ref = (uintptr_t)ret_var.inner;
39060 if (ret_var.is_owned) {
39066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39067 LDKInitFeatures this_arg_conv;
39068 this_arg_conv.inner = (void*)(this_arg & (~1));
39069 this_arg_conv.is_owned = false;
39070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39071 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
39075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
39076 LDKNodeFeatures ret_var = NodeFeatures_empty();
39077 int64_t ret_ref = 0;
39078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39081 ret_ref = (uintptr_t)ret_var.inner;
39082 if (ret_var.is_owned) {
39088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
39089 LDKNodeFeatures ret_var = NodeFeatures_known();
39090 int64_t ret_ref = 0;
39091 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39092 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39094 ret_ref = (uintptr_t)ret_var.inner;
39095 if (ret_var.is_owned) {
39101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39102 LDKNodeFeatures this_arg_conv;
39103 this_arg_conv.inner = (void*)(this_arg & (~1));
39104 this_arg_conv.is_owned = false;
39105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39106 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
39110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
39111 LDKChannelFeatures ret_var = ChannelFeatures_empty();
39112 int64_t ret_ref = 0;
39113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39116 ret_ref = (uintptr_t)ret_var.inner;
39117 if (ret_var.is_owned) {
39123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
39124 LDKChannelFeatures ret_var = ChannelFeatures_known();
39125 int64_t ret_ref = 0;
39126 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39127 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39129 ret_ref = (uintptr_t)ret_var.inner;
39130 if (ret_var.is_owned) {
39136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39137 LDKChannelFeatures this_arg_conv;
39138 this_arg_conv.inner = (void*)(this_arg & (~1));
39139 this_arg_conv.is_owned = false;
39140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39141 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
39145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
39146 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
39147 int64_t ret_ref = 0;
39148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39151 ret_ref = (uintptr_t)ret_var.inner;
39152 if (ret_var.is_owned) {
39158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
39159 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
39160 int64_t ret_ref = 0;
39161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39164 ret_ref = (uintptr_t)ret_var.inner;
39165 if (ret_var.is_owned) {
39171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39172 LDKInvoiceFeatures this_arg_conv;
39173 this_arg_conv.inner = (void*)(this_arg & (~1));
39174 this_arg_conv.is_owned = false;
39175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39176 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
39180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
39181 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
39182 int64_t ret_ref = 0;
39183 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39184 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39186 ret_ref = (uintptr_t)ret_var.inner;
39187 if (ret_var.is_owned) {
39193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
39194 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
39195 int64_t ret_ref = 0;
39196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39199 ret_ref = (uintptr_t)ret_var.inner;
39200 if (ret_var.is_owned) {
39206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39207 LDKChannelTypeFeatures this_arg_conv;
39208 this_arg_conv.inner = (void*)(this_arg & (~1));
39209 this_arg_conv.is_owned = false;
39210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39211 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
39215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39216 LDKInitFeatures obj_conv;
39217 obj_conv.inner = (void*)(obj & (~1));
39218 obj_conv.is_owned = false;
39219 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39220 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
39221 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39222 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39223 CVec_u8Z_free(ret_var);
39227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39228 LDKu8slice ser_ref;
39229 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39230 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39231 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
39232 *ret_conv = InitFeatures_read(ser_ref);
39233 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39234 return (int64_t)ret_conv;
39237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39238 LDKChannelFeatures obj_conv;
39239 obj_conv.inner = (void*)(obj & (~1));
39240 obj_conv.is_owned = false;
39241 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39242 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
39243 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39244 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39245 CVec_u8Z_free(ret_var);
39249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39250 LDKu8slice ser_ref;
39251 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39252 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39253 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
39254 *ret_conv = ChannelFeatures_read(ser_ref);
39255 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39256 return (int64_t)ret_conv;
39259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39260 LDKNodeFeatures obj_conv;
39261 obj_conv.inner = (void*)(obj & (~1));
39262 obj_conv.is_owned = false;
39263 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39264 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
39265 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39266 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39267 CVec_u8Z_free(ret_var);
39271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39272 LDKu8slice ser_ref;
39273 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39274 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39275 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
39276 *ret_conv = NodeFeatures_read(ser_ref);
39277 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39278 return (int64_t)ret_conv;
39281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39282 LDKInvoiceFeatures obj_conv;
39283 obj_conv.inner = (void*)(obj & (~1));
39284 obj_conv.is_owned = false;
39285 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39286 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
39287 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39288 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39289 CVec_u8Z_free(ret_var);
39293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39294 LDKu8slice ser_ref;
39295 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39296 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39297 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
39298 *ret_conv = InvoiceFeatures_read(ser_ref);
39299 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39300 return (int64_t)ret_conv;
39303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39304 LDKChannelTypeFeatures obj_conv;
39305 obj_conv.inner = (void*)(obj & (~1));
39306 obj_conv.is_owned = false;
39307 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39308 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
39309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39311 CVec_u8Z_free(ret_var);
39315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39316 LDKu8slice ser_ref;
39317 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39318 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39319 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
39320 *ret_conv = ChannelTypeFeatures_read(ser_ref);
39321 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39322 return (int64_t)ret_conv;
39325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39326 LDKShutdownScript this_obj_conv;
39327 this_obj_conv.inner = (void*)(this_obj & (~1));
39328 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39330 ShutdownScript_free(this_obj_conv);
39333 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
39334 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
39335 int64_t ret_ref = 0;
39336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39339 ret_ref = (uintptr_t)ret_var.inner;
39340 if (ret_var.is_owned) {
39345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39346 LDKShutdownScript arg_conv;
39347 arg_conv.inner = (void*)(arg & (~1));
39348 arg_conv.is_owned = false;
39349 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39350 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
39354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39355 LDKShutdownScript orig_conv;
39356 orig_conv.inner = (void*)(orig & (~1));
39357 orig_conv.is_owned = false;
39358 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39359 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
39360 int64_t ret_ref = 0;
39361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39364 ret_ref = (uintptr_t)ret_var.inner;
39365 if (ret_var.is_owned) {
39371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39372 LDKInvalidShutdownScript this_obj_conv;
39373 this_obj_conv.inner = (void*)(this_obj & (~1));
39374 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39376 InvalidShutdownScript_free(this_obj_conv);
39379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
39380 LDKInvalidShutdownScript this_ptr_conv;
39381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39382 this_ptr_conv.is_owned = false;
39383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39384 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
39385 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39386 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39391 LDKInvalidShutdownScript this_ptr_conv;
39392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39393 this_ptr_conv.is_owned = false;
39394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39395 LDKCVec_u8Z val_ref;
39396 val_ref.datalen = (*env)->GetArrayLength(env, val);
39397 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39398 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
39399 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
39402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
39403 LDKCVec_u8Z script_arg_ref;
39404 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
39405 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39406 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
39407 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
39408 int64_t ret_ref = 0;
39409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39412 ret_ref = (uintptr_t)ret_var.inner;
39413 if (ret_var.is_owned) {
39419 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
39420 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
39421 int64_t ret_ref = 0;
39422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39425 ret_ref = (uintptr_t)ret_var.inner;
39426 if (ret_var.is_owned) {
39431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39432 LDKInvalidShutdownScript arg_conv;
39433 arg_conv.inner = (void*)(arg & (~1));
39434 arg_conv.is_owned = false;
39435 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39436 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
39440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39441 LDKInvalidShutdownScript orig_conv;
39442 orig_conv.inner = (void*)(orig & (~1));
39443 orig_conv.is_owned = false;
39444 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39445 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
39446 int64_t ret_ref = 0;
39447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39450 ret_ref = (uintptr_t)ret_var.inner;
39451 if (ret_var.is_owned) {
39457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
39458 LDKShutdownScript obj_conv;
39459 obj_conv.inner = (void*)(obj & (~1));
39460 obj_conv.is_owned = false;
39461 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39462 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
39463 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39464 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39465 CVec_u8Z_free(ret_var);
39469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39470 LDKu8slice ser_ref;
39471 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39472 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39473 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
39474 *ret_conv = ShutdownScript_read(ser_ref);
39475 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39476 return (int64_t)ret_conv;
39479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
39480 unsigned char pubkey_hash_arr[20];
39481 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
39482 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
39483 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
39484 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
39485 int64_t ret_ref = 0;
39486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39489 ret_ref = (uintptr_t)ret_var.inner;
39490 if (ret_var.is_owned) {
39496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
39497 unsigned char script_hash_arr[32];
39498 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
39499 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
39500 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
39501 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
39502 int64_t ret_ref = 0;
39503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39506 ret_ref = (uintptr_t)ret_var.inner;
39507 if (ret_var.is_owned) {
39513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
39514 LDKu8slice program_ref;
39515 program_ref.datalen = (*env)->GetArrayLength(env, program);
39516 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
39517 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
39518 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
39519 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
39520 return (int64_t)ret_conv;
39523 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
39524 LDKShutdownScript this_arg_conv;
39525 this_arg_conv.inner = (void*)(this_arg & (~1));
39526 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
39527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39528 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
39529 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
39530 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39531 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39532 CVec_u8Z_free(ret_var);
39536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
39537 LDKShutdownScript this_arg_conv;
39538 this_arg_conv.inner = (void*)(this_arg & (~1));
39539 this_arg_conv.is_owned = false;
39540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39541 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39542 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
39546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
39547 LDKShutdownScript this_arg_conv;
39548 this_arg_conv.inner = (void*)(this_arg & (~1));
39549 this_arg_conv.is_owned = false;
39550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39551 LDKInitFeatures features_conv;
39552 features_conv.inner = (void*)(features & (~1));
39553 features_conv.is_owned = false;
39554 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39555 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
39559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39560 if ((this_ptr & 1) != 0) return;
39561 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39562 CHECK_ACCESS(this_ptr_ptr);
39563 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
39564 FREE((void*)this_ptr);
39565 CustomMessageReader_free(this_ptr_conv);
39568 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
39569 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39570 *ret_ret = Type_clone(arg);
39571 return (int64_t)ret_ret;
39573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39574 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39575 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
39576 LDKType* arg_conv = (LDKType*)arg_ptr;
39577 int64_t ret_val = Type_clone_ptr(arg_conv);
39581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39582 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
39583 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
39584 LDKType* orig_conv = (LDKType*)orig_ptr;
39585 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39586 *ret_ret = Type_clone(orig_conv);
39587 return (int64_t)ret_ret;
39590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39591 if ((this_ptr & 1) != 0) return;
39592 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39593 CHECK_ACCESS(this_ptr_ptr);
39594 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
39595 FREE((void*)this_ptr);
39596 Type_free(this_ptr_conv);
39599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39600 LDKNodeId this_obj_conv;
39601 this_obj_conv.inner = (void*)(this_obj & (~1));
39602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39604 NodeId_free(this_obj_conv);
39607 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
39608 LDKNodeId ret_var = NodeId_clone(arg);
39609 int64_t ret_ref = 0;
39610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39613 ret_ref = (uintptr_t)ret_var.inner;
39614 if (ret_var.is_owned) {
39619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39620 LDKNodeId arg_conv;
39621 arg_conv.inner = (void*)(arg & (~1));
39622 arg_conv.is_owned = false;
39623 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39624 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
39628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39629 LDKNodeId orig_conv;
39630 orig_conv.inner = (void*)(orig & (~1));
39631 orig_conv.is_owned = false;
39632 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39633 LDKNodeId ret_var = NodeId_clone(&orig_conv);
39634 int64_t ret_ref = 0;
39635 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39636 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39638 ret_ref = (uintptr_t)ret_var.inner;
39639 if (ret_var.is_owned) {
39645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
39646 LDKPublicKey pubkey_ref;
39647 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
39648 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
39649 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
39650 int64_t ret_ref = 0;
39651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39654 ret_ref = (uintptr_t)ret_var.inner;
39655 if (ret_var.is_owned) {
39661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
39662 LDKNodeId this_arg_conv;
39663 this_arg_conv.inner = (void*)(this_arg & (~1));
39664 this_arg_conv.is_owned = false;
39665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39666 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
39667 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39668 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
39674 o_conv.inner = (void*)(o & (~1));
39675 o_conv.is_owned = false;
39676 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39677 int64_t ret_val = NodeId_hash(&o_conv);
39681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
39682 LDKNodeId obj_conv;
39683 obj_conv.inner = (void*)(obj & (~1));
39684 obj_conv.is_owned = false;
39685 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39686 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
39687 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39688 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39689 CVec_u8Z_free(ret_var);
39693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39694 LDKu8slice ser_ref;
39695 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39696 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39697 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
39698 *ret_conv = NodeId_read(ser_ref);
39699 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39700 return (int64_t)ret_conv;
39703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39704 LDKNetworkGraph this_obj_conv;
39705 this_obj_conv.inner = (void*)(this_obj & (~1));
39706 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39708 NetworkGraph_free(this_obj_conv);
39711 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
39712 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
39713 int64_t ret_ref = 0;
39714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39717 ret_ref = (uintptr_t)ret_var.inner;
39718 if (ret_var.is_owned) {
39723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39724 LDKNetworkGraph arg_conv;
39725 arg_conv.inner = (void*)(arg & (~1));
39726 arg_conv.is_owned = false;
39727 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39728 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
39732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39733 LDKNetworkGraph orig_conv;
39734 orig_conv.inner = (void*)(orig & (~1));
39735 orig_conv.is_owned = false;
39736 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39737 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
39738 int64_t ret_ref = 0;
39739 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39740 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39742 ret_ref = (uintptr_t)ret_var.inner;
39743 if (ret_var.is_owned) {
39749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39750 LDKReadOnlyNetworkGraph this_obj_conv;
39751 this_obj_conv.inner = (void*)(this_obj & (~1));
39752 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39754 ReadOnlyNetworkGraph_free(this_obj_conv);
39757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39758 if ((this_ptr & 1) != 0) return;
39759 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39760 CHECK_ACCESS(this_ptr_ptr);
39761 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
39762 FREE((void*)this_ptr);
39763 NetworkUpdate_free(this_ptr_conv);
39766 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
39767 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39768 *ret_copy = NetworkUpdate_clone(arg);
39769 int64_t ret_ref = (uintptr_t)ret_copy;
39772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39773 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
39774 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
39778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39779 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
39780 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39781 *ret_copy = NetworkUpdate_clone(orig_conv);
39782 int64_t ret_ref = (uintptr_t)ret_copy;
39786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
39787 LDKChannelUpdate msg_conv;
39788 msg_conv.inner = (void*)(msg & (~1));
39789 msg_conv.is_owned = (msg & 1) || (msg == 0);
39790 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39791 msg_conv = ChannelUpdate_clone(&msg_conv);
39792 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39793 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
39794 int64_t ret_ref = (uintptr_t)ret_copy;
39798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
39799 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39800 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
39801 int64_t ret_ref = (uintptr_t)ret_copy;
39805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
39806 LDKPublicKey node_id_ref;
39807 CHECK((*env)->GetArrayLength(env, node_id) == 33);
39808 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
39809 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39810 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
39811 int64_t ret_ref = (uintptr_t)ret_copy;
39815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
39816 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
39817 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
39818 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39819 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39820 CVec_u8Z_free(ret_var);
39824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39825 LDKu8slice ser_ref;
39826 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39827 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39828 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
39829 *ret_conv = NetworkUpdate_read(ser_ref);
39830 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39831 return (int64_t)ret_conv;
39834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39835 LDKNetGraphMsgHandler this_arg_conv;
39836 this_arg_conv.inner = (void*)(this_arg & (~1));
39837 this_arg_conv.is_owned = false;
39838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39839 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
39840 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
39841 return (int64_t)ret_ret;
39844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39845 LDKNetGraphMsgHandler this_obj_conv;
39846 this_obj_conv.inner = (void*)(this_obj & (~1));
39847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39849 NetGraphMsgHandler_free(this_obj_conv);
39852 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) {
39853 LDKNetworkGraph network_graph_conv;
39854 network_graph_conv.inner = (void*)(network_graph & (~1));
39855 network_graph_conv.is_owned = false;
39856 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39857 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39858 CHECK_ACCESS(chain_access_ptr);
39859 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39860 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39861 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39862 // Manually implement clone for Java trait instances
39863 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39864 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39865 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39868 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39869 CHECK_ACCESS(logger_ptr);
39870 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39871 if (logger_conv.free == LDKLogger_JCalls_free) {
39872 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39873 LDKLogger_JCalls_cloned(&logger_conv);
39875 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
39876 int64_t ret_ref = 0;
39877 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39878 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39880 ret_ref = (uintptr_t)ret_var.inner;
39881 if (ret_var.is_owned) {
39887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
39888 LDKNetGraphMsgHandler this_arg_conv;
39889 this_arg_conv.inner = (void*)(this_arg & (~1));
39890 this_arg_conv.is_owned = false;
39891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39892 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39893 CHECK_ACCESS(chain_access_ptr);
39894 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39895 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39896 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39897 // Manually implement clone for Java trait instances
39898 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39899 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39900 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39903 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
39906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39907 LDKNetGraphMsgHandler this_arg_conv;
39908 this_arg_conv.inner = (void*)(this_arg & (~1));
39909 this_arg_conv.is_owned = false;
39910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39911 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
39912 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
39913 return (int64_t)ret_ret;
39916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
39917 LDKNetGraphMsgHandler this_arg_conv;
39918 this_arg_conv.inner = (void*)(this_arg & (~1));
39919 this_arg_conv.is_owned = false;
39920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39921 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39922 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
39923 return (int64_t)ret_ret;
39926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39927 LDKChannelUpdateInfo this_obj_conv;
39928 this_obj_conv.inner = (void*)(this_obj & (~1));
39929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39931 ChannelUpdateInfo_free(this_obj_conv);
39934 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
39935 LDKChannelUpdateInfo this_ptr_conv;
39936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39937 this_ptr_conv.is_owned = false;
39938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39939 int32_t ret_val = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
39943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39944 LDKChannelUpdateInfo this_ptr_conv;
39945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39946 this_ptr_conv.is_owned = false;
39947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39948 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
39951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
39952 LDKChannelUpdateInfo this_ptr_conv;
39953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39954 this_ptr_conv.is_owned = false;
39955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39956 jboolean ret_val = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
39960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39961 LDKChannelUpdateInfo this_ptr_conv;
39962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39963 this_ptr_conv.is_owned = false;
39964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39965 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
39968 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39969 LDKChannelUpdateInfo this_ptr_conv;
39970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39971 this_ptr_conv.is_owned = false;
39972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39973 int16_t ret_val = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
39977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39978 LDKChannelUpdateInfo this_ptr_conv;
39979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39980 this_ptr_conv.is_owned = false;
39981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39982 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39986 LDKChannelUpdateInfo this_ptr_conv;
39987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39988 this_ptr_conv.is_owned = false;
39989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39990 int64_t ret_val = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
39994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39995 LDKChannelUpdateInfo this_ptr_conv;
39996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39997 this_ptr_conv.is_owned = false;
39998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39999 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
40002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40003 LDKChannelUpdateInfo this_ptr_conv;
40004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40005 this_ptr_conv.is_owned = false;
40006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40007 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40008 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
40009 int64_t ret_ref = (uintptr_t)ret_copy;
40013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40014 LDKChannelUpdateInfo this_ptr_conv;
40015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40016 this_ptr_conv.is_owned = false;
40017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40018 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40019 CHECK_ACCESS(val_ptr);
40020 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40021 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40022 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
40025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
40026 LDKChannelUpdateInfo this_ptr_conv;
40027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40028 this_ptr_conv.is_owned = false;
40029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40030 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
40031 int64_t ret_ref = 0;
40032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40035 ret_ref = (uintptr_t)ret_var.inner;
40036 if (ret_var.is_owned) {
40042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40043 LDKChannelUpdateInfo this_ptr_conv;
40044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40045 this_ptr_conv.is_owned = false;
40046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40047 LDKRoutingFees val_conv;
40048 val_conv.inner = (void*)(val & (~1));
40049 val_conv.is_owned = (val & 1) || (val == 0);
40050 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40051 val_conv = RoutingFees_clone(&val_conv);
40052 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
40055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40056 LDKChannelUpdateInfo this_ptr_conv;
40057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40058 this_ptr_conv.is_owned = false;
40059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40060 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
40061 int64_t ret_ref = 0;
40062 if ((uintptr_t)ret_var.inner > 4096) {
40063 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40064 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40065 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40066 ret_ref = (uintptr_t)ret_var.inner;
40067 if (ret_var.is_owned) {
40074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40075 LDKChannelUpdateInfo this_ptr_conv;
40076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40077 this_ptr_conv.is_owned = false;
40078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40079 LDKChannelUpdate val_conv;
40080 val_conv.inner = (void*)(val & (~1));
40081 val_conv.is_owned = (val & 1) || (val == 0);
40082 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40083 val_conv = ChannelUpdate_clone(&val_conv);
40084 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
40087 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) {
40088 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
40089 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
40090 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
40091 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
40092 LDKRoutingFees fees_arg_conv;
40093 fees_arg_conv.inner = (void*)(fees_arg & (~1));
40094 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
40095 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
40096 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
40097 LDKChannelUpdate last_update_message_arg_conv;
40098 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
40099 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
40100 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
40101 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
40102 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);
40103 int64_t ret_ref = 0;
40104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40107 ret_ref = (uintptr_t)ret_var.inner;
40108 if (ret_var.is_owned) {
40114 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
40115 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
40116 int64_t ret_ref = 0;
40117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40120 ret_ref = (uintptr_t)ret_var.inner;
40121 if (ret_var.is_owned) {
40126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40127 LDKChannelUpdateInfo arg_conv;
40128 arg_conv.inner = (void*)(arg & (~1));
40129 arg_conv.is_owned = false;
40130 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40131 int64_t ret_val = ChannelUpdateInfo_clone_ptr(&arg_conv);
40135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40136 LDKChannelUpdateInfo orig_conv;
40137 orig_conv.inner = (void*)(orig & (~1));
40138 orig_conv.is_owned = false;
40139 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40140 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
40141 int64_t ret_ref = 0;
40142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40145 ret_ref = (uintptr_t)ret_var.inner;
40146 if (ret_var.is_owned) {
40152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40153 LDKChannelUpdateInfo obj_conv;
40154 obj_conv.inner = (void*)(obj & (~1));
40155 obj_conv.is_owned = false;
40156 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40157 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
40158 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40159 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40160 CVec_u8Z_free(ret_var);
40164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40165 LDKu8slice ser_ref;
40166 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40167 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40168 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
40169 *ret_conv = ChannelUpdateInfo_read(ser_ref);
40170 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40171 return (int64_t)ret_conv;
40174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40175 LDKChannelInfo this_obj_conv;
40176 this_obj_conv.inner = (void*)(this_obj & (~1));
40177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40179 ChannelInfo_free(this_obj_conv);
40182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40183 LDKChannelInfo this_ptr_conv;
40184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40185 this_ptr_conv.is_owned = false;
40186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40187 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
40188 int64_t ret_ref = 0;
40189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40192 ret_ref = (uintptr_t)ret_var.inner;
40193 if (ret_var.is_owned) {
40199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40200 LDKChannelInfo this_ptr_conv;
40201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40202 this_ptr_conv.is_owned = false;
40203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40204 LDKChannelFeatures val_conv;
40205 val_conv.inner = (void*)(val & (~1));
40206 val_conv.is_owned = (val & 1) || (val == 0);
40207 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40208 val_conv = ChannelFeatures_clone(&val_conv);
40209 ChannelInfo_set_features(&this_ptr_conv, val_conv);
40212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
40213 LDKChannelInfo this_ptr_conv;
40214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40215 this_ptr_conv.is_owned = false;
40216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40217 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
40218 int64_t ret_ref = 0;
40219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40222 ret_ref = (uintptr_t)ret_var.inner;
40223 if (ret_var.is_owned) {
40229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40230 LDKChannelInfo this_ptr_conv;
40231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40232 this_ptr_conv.is_owned = false;
40233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40234 LDKNodeId val_conv;
40235 val_conv.inner = (void*)(val & (~1));
40236 val_conv.is_owned = (val & 1) || (val == 0);
40237 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40238 val_conv = NodeId_clone(&val_conv);
40239 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
40242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
40243 LDKChannelInfo this_ptr_conv;
40244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40245 this_ptr_conv.is_owned = false;
40246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40247 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
40248 int64_t ret_ref = 0;
40249 if ((uintptr_t)ret_var.inner > 4096) {
40250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40253 ret_ref = (uintptr_t)ret_var.inner;
40254 if (ret_var.is_owned) {
40261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40262 LDKChannelInfo this_ptr_conv;
40263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40264 this_ptr_conv.is_owned = false;
40265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40266 LDKChannelUpdateInfo val_conv;
40267 val_conv.inner = (void*)(val & (~1));
40268 val_conv.is_owned = (val & 1) || (val == 0);
40269 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40270 val_conv = ChannelUpdateInfo_clone(&val_conv);
40271 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
40274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
40275 LDKChannelInfo this_ptr_conv;
40276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40277 this_ptr_conv.is_owned = false;
40278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40279 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
40280 int64_t ret_ref = 0;
40281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40284 ret_ref = (uintptr_t)ret_var.inner;
40285 if (ret_var.is_owned) {
40291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40292 LDKChannelInfo this_ptr_conv;
40293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40294 this_ptr_conv.is_owned = false;
40295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40296 LDKNodeId val_conv;
40297 val_conv.inner = (void*)(val & (~1));
40298 val_conv.is_owned = (val & 1) || (val == 0);
40299 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40300 val_conv = NodeId_clone(&val_conv);
40301 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
40304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
40305 LDKChannelInfo this_ptr_conv;
40306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40307 this_ptr_conv.is_owned = false;
40308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40309 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
40310 int64_t ret_ref = 0;
40311 if ((uintptr_t)ret_var.inner > 4096) {
40312 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40313 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40315 ret_ref = (uintptr_t)ret_var.inner;
40316 if (ret_var.is_owned) {
40323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40324 LDKChannelInfo this_ptr_conv;
40325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40326 this_ptr_conv.is_owned = false;
40327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40328 LDKChannelUpdateInfo val_conv;
40329 val_conv.inner = (void*)(val & (~1));
40330 val_conv.is_owned = (val & 1) || (val == 0);
40331 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40332 val_conv = ChannelUpdateInfo_clone(&val_conv);
40333 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
40336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
40337 LDKChannelInfo this_ptr_conv;
40338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40339 this_ptr_conv.is_owned = false;
40340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40341 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40342 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
40343 int64_t ret_ref = (uintptr_t)ret_copy;
40347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40348 LDKChannelInfo this_ptr_conv;
40349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40350 this_ptr_conv.is_owned = false;
40351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40352 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40353 CHECK_ACCESS(val_ptr);
40354 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40355 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40356 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
40359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40360 LDKChannelInfo this_ptr_conv;
40361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40362 this_ptr_conv.is_owned = false;
40363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40364 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
40365 int64_t ret_ref = 0;
40366 if ((uintptr_t)ret_var.inner > 4096) {
40367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40370 ret_ref = (uintptr_t)ret_var.inner;
40371 if (ret_var.is_owned) {
40378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40379 LDKChannelInfo this_ptr_conv;
40380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40381 this_ptr_conv.is_owned = false;
40382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40383 LDKChannelAnnouncement val_conv;
40384 val_conv.inner = (void*)(val & (~1));
40385 val_conv.is_owned = (val & 1) || (val == 0);
40386 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40387 val_conv = ChannelAnnouncement_clone(&val_conv);
40388 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
40391 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
40392 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
40393 int64_t ret_ref = 0;
40394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40397 ret_ref = (uintptr_t)ret_var.inner;
40398 if (ret_var.is_owned) {
40403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40404 LDKChannelInfo arg_conv;
40405 arg_conv.inner = (void*)(arg & (~1));
40406 arg_conv.is_owned = false;
40407 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40408 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
40412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40413 LDKChannelInfo orig_conv;
40414 orig_conv.inner = (void*)(orig & (~1));
40415 orig_conv.is_owned = false;
40416 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40417 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
40418 int64_t ret_ref = 0;
40419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40422 ret_ref = (uintptr_t)ret_var.inner;
40423 if (ret_var.is_owned) {
40429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40430 LDKChannelInfo obj_conv;
40431 obj_conv.inner = (void*)(obj & (~1));
40432 obj_conv.is_owned = false;
40433 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40434 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
40435 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40436 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40437 CVec_u8Z_free(ret_var);
40441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40442 LDKu8slice ser_ref;
40443 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40444 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40445 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
40446 *ret_conv = ChannelInfo_read(ser_ref);
40447 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40448 return (int64_t)ret_conv;
40451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40452 LDKDirectedChannelInfo this_obj_conv;
40453 this_obj_conv.inner = (void*)(this_obj & (~1));
40454 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40456 DirectedChannelInfo_free(this_obj_conv);
40459 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
40460 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
40461 int64_t ret_ref = 0;
40462 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40463 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40465 ret_ref = (uintptr_t)ret_var.inner;
40466 if (ret_var.is_owned) {
40471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40472 LDKDirectedChannelInfo arg_conv;
40473 arg_conv.inner = (void*)(arg & (~1));
40474 arg_conv.is_owned = false;
40475 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40476 int64_t ret_val = DirectedChannelInfo_clone_ptr(&arg_conv);
40480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40481 LDKDirectedChannelInfo orig_conv;
40482 orig_conv.inner = (void*)(orig & (~1));
40483 orig_conv.is_owned = false;
40484 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40485 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
40486 int64_t ret_ref = 0;
40487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40490 ret_ref = (uintptr_t)ret_var.inner;
40491 if (ret_var.is_owned) {
40497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
40498 LDKDirectedChannelInfo this_arg_conv;
40499 this_arg_conv.inner = (void*)(this_arg & (~1));
40500 this_arg_conv.is_owned = false;
40501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40502 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
40503 int64_t ret_ref = 0;
40504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40507 ret_ref = (uintptr_t)ret_var.inner;
40508 if (ret_var.is_owned) {
40514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
40515 LDKDirectedChannelInfo this_arg_conv;
40516 this_arg_conv.inner = (void*)(this_arg & (~1));
40517 this_arg_conv.is_owned = false;
40518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40519 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
40520 int64_t ret_ref = 0;
40521 if ((uintptr_t)ret_var.inner > 4096) {
40522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40525 ret_ref = (uintptr_t)ret_var.inner;
40526 if (ret_var.is_owned) {
40533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
40534 LDKDirectedChannelInfo this_arg_conv;
40535 this_arg_conv.inner = (void*)(this_arg & (~1));
40536 this_arg_conv.is_owned = false;
40537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40538 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40539 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
40540 int64_t ret_ref = (uintptr_t)ret_copy;
40544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40545 if ((this_ptr & 1) != 0) return;
40546 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40547 CHECK_ACCESS(this_ptr_ptr);
40548 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
40549 FREE((void*)this_ptr);
40550 EffectiveCapacity_free(this_ptr_conv);
40553 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
40554 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40555 *ret_copy = EffectiveCapacity_clone(arg);
40556 int64_t ret_ref = (uintptr_t)ret_copy;
40559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40560 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
40561 int64_t ret_val = EffectiveCapacity_clone_ptr(arg_conv);
40565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40566 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
40567 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40568 *ret_copy = EffectiveCapacity_clone(orig_conv);
40569 int64_t ret_ref = (uintptr_t)ret_copy;
40573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
40574 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40575 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
40576 int64_t ret_ref = (uintptr_t)ret_copy;
40580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
40581 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40582 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
40583 int64_t ret_ref = (uintptr_t)ret_copy;
40587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat) {
40588 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40589 *ret_copy = EffectiveCapacity_total(capacity_msat);
40590 int64_t ret_ref = (uintptr_t)ret_copy;
40594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
40595 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40596 *ret_copy = EffectiveCapacity_infinite();
40597 int64_t ret_ref = (uintptr_t)ret_copy;
40601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
40602 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40603 *ret_copy = EffectiveCapacity_unknown();
40604 int64_t ret_ref = (uintptr_t)ret_copy;
40608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
40609 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
40610 int64_t ret_val = EffectiveCapacity_as_msat(this_arg_conv);
40614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40615 LDKRoutingFees this_obj_conv;
40616 this_obj_conv.inner = (void*)(this_obj & (~1));
40617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40619 RoutingFees_free(this_obj_conv);
40622 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40623 LDKRoutingFees this_ptr_conv;
40624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40625 this_ptr_conv.is_owned = false;
40626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40627 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
40631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40632 LDKRoutingFees this_ptr_conv;
40633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40634 this_ptr_conv.is_owned = false;
40635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40636 RoutingFees_set_base_msat(&this_ptr_conv, val);
40639 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
40640 LDKRoutingFees this_ptr_conv;
40641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40642 this_ptr_conv.is_owned = false;
40643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40644 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
40648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40649 LDKRoutingFees this_ptr_conv;
40650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40651 this_ptr_conv.is_owned = false;
40652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40653 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
40656 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) {
40657 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
40658 int64_t ret_ref = 0;
40659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40662 ret_ref = (uintptr_t)ret_var.inner;
40663 if (ret_var.is_owned) {
40669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40670 LDKRoutingFees a_conv;
40671 a_conv.inner = (void*)(a & (~1));
40672 a_conv.is_owned = false;
40673 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40674 LDKRoutingFees b_conv;
40675 b_conv.inner = (void*)(b & (~1));
40676 b_conv.is_owned = false;
40677 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40678 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
40682 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
40683 LDKRoutingFees ret_var = RoutingFees_clone(arg);
40684 int64_t ret_ref = 0;
40685 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40686 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40688 ret_ref = (uintptr_t)ret_var.inner;
40689 if (ret_var.is_owned) {
40694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40695 LDKRoutingFees arg_conv;
40696 arg_conv.inner = (void*)(arg & (~1));
40697 arg_conv.is_owned = false;
40698 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40699 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
40703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40704 LDKRoutingFees orig_conv;
40705 orig_conv.inner = (void*)(orig & (~1));
40706 orig_conv.is_owned = false;
40707 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40708 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
40709 int64_t ret_ref = 0;
40710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40713 ret_ref = (uintptr_t)ret_var.inner;
40714 if (ret_var.is_owned) {
40720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
40721 LDKRoutingFees o_conv;
40722 o_conv.inner = (void*)(o & (~1));
40723 o_conv.is_owned = false;
40724 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40725 int64_t ret_val = RoutingFees_hash(&o_conv);
40729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
40730 LDKRoutingFees obj_conv;
40731 obj_conv.inner = (void*)(obj & (~1));
40732 obj_conv.is_owned = false;
40733 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40734 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
40735 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40736 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40737 CVec_u8Z_free(ret_var);
40741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40742 LDKu8slice ser_ref;
40743 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40744 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40745 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
40746 *ret_conv = RoutingFees_read(ser_ref);
40747 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40748 return (int64_t)ret_conv;
40751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40752 LDKNodeAnnouncementInfo this_obj_conv;
40753 this_obj_conv.inner = (void*)(this_obj & (~1));
40754 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40756 NodeAnnouncementInfo_free(this_obj_conv);
40759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40760 LDKNodeAnnouncementInfo this_ptr_conv;
40761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40762 this_ptr_conv.is_owned = false;
40763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40764 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
40765 int64_t ret_ref = 0;
40766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40769 ret_ref = (uintptr_t)ret_var.inner;
40770 if (ret_var.is_owned) {
40776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40777 LDKNodeAnnouncementInfo this_ptr_conv;
40778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40779 this_ptr_conv.is_owned = false;
40780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40781 LDKNodeFeatures val_conv;
40782 val_conv.inner = (void*)(val & (~1));
40783 val_conv.is_owned = (val & 1) || (val == 0);
40784 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40785 val_conv = NodeFeatures_clone(&val_conv);
40786 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
40789 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
40790 LDKNodeAnnouncementInfo this_ptr_conv;
40791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40792 this_ptr_conv.is_owned = false;
40793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40794 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
40798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40799 LDKNodeAnnouncementInfo this_ptr_conv;
40800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40801 this_ptr_conv.is_owned = false;
40802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40803 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
40806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
40807 LDKNodeAnnouncementInfo this_ptr_conv;
40808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40809 this_ptr_conv.is_owned = false;
40810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40811 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
40812 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
40816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40817 LDKNodeAnnouncementInfo this_ptr_conv;
40818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40819 this_ptr_conv.is_owned = false;
40820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40821 LDKThreeBytes val_ref;
40822 CHECK((*env)->GetArrayLength(env, val) == 3);
40823 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
40824 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
40827 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
40828 LDKNodeAnnouncementInfo this_ptr_conv;
40829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40830 this_ptr_conv.is_owned = false;
40831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40832 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40833 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
40837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40838 LDKNodeAnnouncementInfo this_ptr_conv;
40839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40840 this_ptr_conv.is_owned = false;
40841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40842 LDKThirtyTwoBytes val_ref;
40843 CHECK((*env)->GetArrayLength(env, val) == 32);
40844 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40845 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
40848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40849 LDKNodeAnnouncementInfo this_ptr_conv;
40850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40851 this_ptr_conv.is_owned = false;
40852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40853 LDKCVec_NetAddressZ val_constr;
40854 val_constr.datalen = (*env)->GetArrayLength(env, val);
40855 if (val_constr.datalen > 0)
40856 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40858 val_constr.data = NULL;
40859 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40860 for (size_t m = 0; m < val_constr.datalen; m++) {
40861 int64_t val_conv_12 = val_vals[m];
40862 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
40863 CHECK_ACCESS(val_conv_12_ptr);
40864 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40865 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
40866 val_constr.data[m] = val_conv_12_conv;
40868 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40869 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
40872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40873 LDKNodeAnnouncementInfo this_ptr_conv;
40874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40875 this_ptr_conv.is_owned = false;
40876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40877 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
40878 int64_t ret_ref = 0;
40879 if ((uintptr_t)ret_var.inner > 4096) {
40880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40883 ret_ref = (uintptr_t)ret_var.inner;
40884 if (ret_var.is_owned) {
40891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40892 LDKNodeAnnouncementInfo this_ptr_conv;
40893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40894 this_ptr_conv.is_owned = false;
40895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40896 LDKNodeAnnouncement val_conv;
40897 val_conv.inner = (void*)(val & (~1));
40898 val_conv.is_owned = (val & 1) || (val == 0);
40899 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40900 val_conv = NodeAnnouncement_clone(&val_conv);
40901 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
40904 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) {
40905 LDKNodeFeatures features_arg_conv;
40906 features_arg_conv.inner = (void*)(features_arg & (~1));
40907 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40908 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40909 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
40910 LDKThreeBytes rgb_arg_ref;
40911 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
40912 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
40913 LDKThirtyTwoBytes alias_arg_ref;
40914 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
40915 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
40916 LDKCVec_NetAddressZ addresses_arg_constr;
40917 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
40918 if (addresses_arg_constr.datalen > 0)
40919 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40921 addresses_arg_constr.data = NULL;
40922 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
40923 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
40924 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
40925 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
40926 CHECK_ACCESS(addresses_arg_conv_12_ptr);
40927 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
40928 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
40930 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
40931 LDKNodeAnnouncement announcement_message_arg_conv;
40932 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
40933 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
40934 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
40935 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
40936 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
40937 int64_t ret_ref = 0;
40938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40941 ret_ref = (uintptr_t)ret_var.inner;
40942 if (ret_var.is_owned) {
40948 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
40949 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
40950 int64_t ret_ref = 0;
40951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40954 ret_ref = (uintptr_t)ret_var.inner;
40955 if (ret_var.is_owned) {
40960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40961 LDKNodeAnnouncementInfo arg_conv;
40962 arg_conv.inner = (void*)(arg & (~1));
40963 arg_conv.is_owned = false;
40964 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40965 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
40969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40970 LDKNodeAnnouncementInfo orig_conv;
40971 orig_conv.inner = (void*)(orig & (~1));
40972 orig_conv.is_owned = false;
40973 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40974 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
40975 int64_t ret_ref = 0;
40976 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40977 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40979 ret_ref = (uintptr_t)ret_var.inner;
40980 if (ret_var.is_owned) {
40986 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40987 LDKNodeAnnouncementInfo obj_conv;
40988 obj_conv.inner = (void*)(obj & (~1));
40989 obj_conv.is_owned = false;
40990 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40991 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
40992 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40993 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40994 CVec_u8Z_free(ret_var);
40998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40999 LDKu8slice ser_ref;
41000 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41001 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41002 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
41003 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
41004 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41005 return (int64_t)ret_conv;
41008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41009 LDKNodeInfo this_obj_conv;
41010 this_obj_conv.inner = (void*)(this_obj & (~1));
41011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41013 NodeInfo_free(this_obj_conv);
41016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
41017 LDKNodeInfo this_ptr_conv;
41018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41019 this_ptr_conv.is_owned = false;
41020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41021 LDKCVec_u64Z val_constr;
41022 val_constr.datalen = (*env)->GetArrayLength(env, val);
41023 if (val_constr.datalen > 0)
41024 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41026 val_constr.data = NULL;
41027 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
41028 for (size_t g = 0; g < val_constr.datalen; g++) {
41029 int64_t val_conv_6 = val_vals[g];
41030 val_constr.data[g] = val_conv_6;
41032 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
41033 NodeInfo_set_channels(&this_ptr_conv, val_constr);
41036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
41037 LDKNodeInfo this_ptr_conv;
41038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41039 this_ptr_conv.is_owned = false;
41040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41041 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
41042 int64_t ret_ref = 0;
41043 if ((uintptr_t)ret_var.inner > 4096) {
41044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41047 ret_ref = (uintptr_t)ret_var.inner;
41048 if (ret_var.is_owned) {
41055 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) {
41056 LDKNodeInfo this_ptr_conv;
41057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41058 this_ptr_conv.is_owned = false;
41059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41060 LDKRoutingFees val_conv;
41061 val_conv.inner = (void*)(val & (~1));
41062 val_conv.is_owned = (val & 1) || (val == 0);
41063 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41064 val_conv = RoutingFees_clone(&val_conv);
41065 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
41068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
41069 LDKNodeInfo this_ptr_conv;
41070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41071 this_ptr_conv.is_owned = false;
41072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41073 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
41074 int64_t ret_ref = 0;
41075 if ((uintptr_t)ret_var.inner > 4096) {
41076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41079 ret_ref = (uintptr_t)ret_var.inner;
41080 if (ret_var.is_owned) {
41087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41088 LDKNodeInfo this_ptr_conv;
41089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41090 this_ptr_conv.is_owned = false;
41091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41092 LDKNodeAnnouncementInfo val_conv;
41093 val_conv.inner = (void*)(val & (~1));
41094 val_conv.is_owned = (val & 1) || (val == 0);
41095 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41096 val_conv = NodeAnnouncementInfo_clone(&val_conv);
41097 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
41100 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) {
41101 LDKCVec_u64Z channels_arg_constr;
41102 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
41103 if (channels_arg_constr.datalen > 0)
41104 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41106 channels_arg_constr.data = NULL;
41107 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
41108 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
41109 int64_t channels_arg_conv_6 = channels_arg_vals[g];
41110 channels_arg_constr.data[g] = channels_arg_conv_6;
41112 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
41113 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
41114 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
41115 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
41116 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
41117 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
41118 LDKNodeAnnouncementInfo announcement_info_arg_conv;
41119 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
41120 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
41121 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
41122 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
41123 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
41124 int64_t ret_ref = 0;
41125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41128 ret_ref = (uintptr_t)ret_var.inner;
41129 if (ret_var.is_owned) {
41135 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
41136 LDKNodeInfo ret_var = NodeInfo_clone(arg);
41137 int64_t ret_ref = 0;
41138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41141 ret_ref = (uintptr_t)ret_var.inner;
41142 if (ret_var.is_owned) {
41147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41148 LDKNodeInfo arg_conv;
41149 arg_conv.inner = (void*)(arg & (~1));
41150 arg_conv.is_owned = false;
41151 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41152 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
41156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41157 LDKNodeInfo orig_conv;
41158 orig_conv.inner = (void*)(orig & (~1));
41159 orig_conv.is_owned = false;
41160 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41161 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
41162 int64_t ret_ref = 0;
41163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41166 ret_ref = (uintptr_t)ret_var.inner;
41167 if (ret_var.is_owned) {
41173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41174 LDKNodeInfo obj_conv;
41175 obj_conv.inner = (void*)(obj & (~1));
41176 obj_conv.is_owned = false;
41177 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41178 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
41179 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41180 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41181 CVec_u8Z_free(ret_var);
41185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41186 LDKu8slice ser_ref;
41187 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41188 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41189 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
41190 *ret_conv = NodeInfo_read(ser_ref);
41191 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41192 return (int64_t)ret_conv;
41195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
41196 LDKNetworkGraph obj_conv;
41197 obj_conv.inner = (void*)(obj & (~1));
41198 obj_conv.is_owned = false;
41199 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41200 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
41201 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41202 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41203 CVec_u8Z_free(ret_var);
41207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41208 LDKu8slice ser_ref;
41209 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41210 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41211 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
41212 *ret_conv = NetworkGraph_read(ser_ref);
41213 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41214 return (int64_t)ret_conv;
41217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
41218 LDKThirtyTwoBytes genesis_hash_ref;
41219 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
41220 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
41221 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
41222 int64_t ret_ref = 0;
41223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41226 ret_ref = (uintptr_t)ret_var.inner;
41227 if (ret_var.is_owned) {
41233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
41234 LDKNetworkGraph this_arg_conv;
41235 this_arg_conv.inner = (void*)(this_arg & (~1));
41236 this_arg_conv.is_owned = false;
41237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41238 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
41239 int64_t ret_ref = 0;
41240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41243 ret_ref = (uintptr_t)ret_var.inner;
41244 if (ret_var.is_owned) {
41250 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) {
41251 LDKNetworkGraph this_arg_conv;
41252 this_arg_conv.inner = (void*)(this_arg & (~1));
41253 this_arg_conv.is_owned = false;
41254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41255 LDKNodeAnnouncement msg_conv;
41256 msg_conv.inner = (void*)(msg & (~1));
41257 msg_conv.is_owned = false;
41258 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41259 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41260 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
41261 return (int64_t)ret_conv;
41264 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) {
41265 LDKNetworkGraph this_arg_conv;
41266 this_arg_conv.inner = (void*)(this_arg & (~1));
41267 this_arg_conv.is_owned = false;
41268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41269 LDKUnsignedNodeAnnouncement msg_conv;
41270 msg_conv.inner = (void*)(msg & (~1));
41271 msg_conv.is_owned = false;
41272 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41273 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41274 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
41275 return (int64_t)ret_conv;
41278 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) {
41279 LDKNetworkGraph this_arg_conv;
41280 this_arg_conv.inner = (void*)(this_arg & (~1));
41281 this_arg_conv.is_owned = false;
41282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41283 LDKChannelAnnouncement msg_conv;
41284 msg_conv.inner = (void*)(msg & (~1));
41285 msg_conv.is_owned = false;
41286 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41287 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
41288 CHECK_ACCESS(chain_access_ptr);
41289 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41290 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41291 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41292 // Manually implement clone for Java trait instances
41293 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41294 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41295 LDKAccess_JCalls_cloned(&chain_access_conv.some);
41298 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41299 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41300 return (int64_t)ret_conv;
41303 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) {
41304 LDKNetworkGraph this_arg_conv;
41305 this_arg_conv.inner = (void*)(this_arg & (~1));
41306 this_arg_conv.is_owned = false;
41307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41308 LDKUnsignedChannelAnnouncement msg_conv;
41309 msg_conv.inner = (void*)(msg & (~1));
41310 msg_conv.is_owned = false;
41311 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41312 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
41313 CHECK_ACCESS(chain_access_ptr);
41314 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41315 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41316 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41317 // Manually implement clone for Java trait instances
41318 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41319 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41320 LDKAccess_JCalls_cloned(&chain_access_conv.some);
41323 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41324 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41325 return (int64_t)ret_conv;
41328 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) {
41329 LDKNetworkGraph this_arg_conv;
41330 this_arg_conv.inner = (void*)(this_arg & (~1));
41331 this_arg_conv.is_owned = false;
41332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41333 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
41336 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) {
41337 LDKNetworkGraph this_arg_conv;
41338 this_arg_conv.inner = (void*)(this_arg & (~1));
41339 this_arg_conv.is_owned = false;
41340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41341 LDKPublicKey _node_id_ref;
41342 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
41343 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
41344 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
41347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
41348 LDKNetworkGraph this_arg_conv;
41349 this_arg_conv.inner = (void*)(this_arg & (~1));
41350 this_arg_conv.is_owned = false;
41351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41352 NetworkGraph_remove_stale_channels(&this_arg_conv);
41355 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) {
41356 LDKNetworkGraph this_arg_conv;
41357 this_arg_conv.inner = (void*)(this_arg & (~1));
41358 this_arg_conv.is_owned = false;
41359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41360 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
41363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
41364 LDKNetworkGraph this_arg_conv;
41365 this_arg_conv.inner = (void*)(this_arg & (~1));
41366 this_arg_conv.is_owned = false;
41367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41368 LDKChannelUpdate msg_conv;
41369 msg_conv.inner = (void*)(msg & (~1));
41370 msg_conv.is_owned = false;
41371 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41372 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41373 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
41374 return (int64_t)ret_conv;
41377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
41378 LDKNetworkGraph this_arg_conv;
41379 this_arg_conv.inner = (void*)(this_arg & (~1));
41380 this_arg_conv.is_owned = false;
41381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41382 LDKUnsignedChannelUpdate msg_conv;
41383 msg_conv.inner = (void*)(msg & (~1));
41384 msg_conv.is_owned = false;
41385 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41386 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41387 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
41388 return (int64_t)ret_conv;
41391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
41392 LDKReadOnlyNetworkGraph this_arg_conv;
41393 this_arg_conv.inner = (void*)(this_arg & (~1));
41394 this_arg_conv.is_owned = false;
41395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41396 LDKPublicKey pubkey_ref;
41397 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
41398 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
41399 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
41400 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
41401 int64_t ret_ref = (uintptr_t)ret_copy;
41405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41406 LDKRouteHop this_obj_conv;
41407 this_obj_conv.inner = (void*)(this_obj & (~1));
41408 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41410 RouteHop_free(this_obj_conv);
41413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41414 LDKRouteHop this_ptr_conv;
41415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41416 this_ptr_conv.is_owned = false;
41417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41418 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41419 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
41423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41424 LDKRouteHop this_ptr_conv;
41425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41426 this_ptr_conv.is_owned = false;
41427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41428 LDKPublicKey val_ref;
41429 CHECK((*env)->GetArrayLength(env, val) == 33);
41430 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41431 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
41434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41435 LDKRouteHop this_ptr_conv;
41436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41437 this_ptr_conv.is_owned = false;
41438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41439 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
41440 int64_t ret_ref = 0;
41441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41444 ret_ref = (uintptr_t)ret_var.inner;
41445 if (ret_var.is_owned) {
41451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41452 LDKRouteHop this_ptr_conv;
41453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41454 this_ptr_conv.is_owned = false;
41455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41456 LDKNodeFeatures val_conv;
41457 val_conv.inner = (void*)(val & (~1));
41458 val_conv.is_owned = (val & 1) || (val == 0);
41459 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41460 val_conv = NodeFeatures_clone(&val_conv);
41461 RouteHop_set_node_features(&this_ptr_conv, val_conv);
41464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41465 LDKRouteHop 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 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
41473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41474 LDKRouteHop this_ptr_conv;
41475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41476 this_ptr_conv.is_owned = false;
41477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41478 RouteHop_set_short_channel_id(&this_ptr_conv, val);
41481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41482 LDKRouteHop this_ptr_conv;
41483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41484 this_ptr_conv.is_owned = false;
41485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41486 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
41487 int64_t ret_ref = 0;
41488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41491 ret_ref = (uintptr_t)ret_var.inner;
41492 if (ret_var.is_owned) {
41498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41499 LDKRouteHop this_ptr_conv;
41500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41501 this_ptr_conv.is_owned = false;
41502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41503 LDKChannelFeatures val_conv;
41504 val_conv.inner = (void*)(val & (~1));
41505 val_conv.is_owned = (val & 1) || (val == 0);
41506 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41507 val_conv = ChannelFeatures_clone(&val_conv);
41508 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
41511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41512 LDKRouteHop this_ptr_conv;
41513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41514 this_ptr_conv.is_owned = false;
41515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41516 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
41520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41521 LDKRouteHop this_ptr_conv;
41522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41523 this_ptr_conv.is_owned = false;
41524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41525 RouteHop_set_fee_msat(&this_ptr_conv, val);
41528 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41529 LDKRouteHop this_ptr_conv;
41530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41531 this_ptr_conv.is_owned = false;
41532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41533 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
41537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41538 LDKRouteHop this_ptr_conv;
41539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41540 this_ptr_conv.is_owned = false;
41541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41542 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41545 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) {
41546 LDKPublicKey pubkey_arg_ref;
41547 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
41548 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
41549 LDKNodeFeatures node_features_arg_conv;
41550 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
41551 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
41552 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
41553 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
41554 LDKChannelFeatures channel_features_arg_conv;
41555 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
41556 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
41557 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
41558 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
41559 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);
41560 int64_t ret_ref = 0;
41561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41564 ret_ref = (uintptr_t)ret_var.inner;
41565 if (ret_var.is_owned) {
41571 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
41572 LDKRouteHop ret_var = RouteHop_clone(arg);
41573 int64_t ret_ref = 0;
41574 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41575 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41577 ret_ref = (uintptr_t)ret_var.inner;
41578 if (ret_var.is_owned) {
41583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41584 LDKRouteHop arg_conv;
41585 arg_conv.inner = (void*)(arg & (~1));
41586 arg_conv.is_owned = false;
41587 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41588 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
41592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41593 LDKRouteHop orig_conv;
41594 orig_conv.inner = (void*)(orig & (~1));
41595 orig_conv.is_owned = false;
41596 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41597 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
41598 int64_t ret_ref = 0;
41599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41602 ret_ref = (uintptr_t)ret_var.inner;
41603 if (ret_var.is_owned) {
41609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
41610 LDKRouteHop o_conv;
41611 o_conv.inner = (void*)(o & (~1));
41612 o_conv.is_owned = false;
41613 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41614 int64_t ret_val = RouteHop_hash(&o_conv);
41618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41619 LDKRouteHop a_conv;
41620 a_conv.inner = (void*)(a & (~1));
41621 a_conv.is_owned = false;
41622 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41623 LDKRouteHop b_conv;
41624 b_conv.inner = (void*)(b & (~1));
41625 b_conv.is_owned = false;
41626 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41627 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
41631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
41632 LDKRouteHop obj_conv;
41633 obj_conv.inner = (void*)(obj & (~1));
41634 obj_conv.is_owned = false;
41635 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41636 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
41637 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41638 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41639 CVec_u8Z_free(ret_var);
41643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41644 LDKu8slice ser_ref;
41645 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41646 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41647 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
41648 *ret_conv = RouteHop_read(ser_ref);
41649 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41650 return (int64_t)ret_conv;
41653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41654 LDKRoute this_obj_conv;
41655 this_obj_conv.inner = (void*)(this_obj & (~1));
41656 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41658 Route_free(this_obj_conv);
41661 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
41662 LDKRoute this_ptr_conv;
41663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41664 this_ptr_conv.is_owned = false;
41665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41666 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
41667 jobjectArray ret_arr = NULL;
41668 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
41670 for (size_t m = 0; m < ret_var.datalen; m++) {
41671 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
41672 int64_tArray ret_conv_12_arr = NULL;
41673 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
41674 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
41675 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
41676 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
41677 int64_t ret_conv_12_conv_10_ref = 0;
41678 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41679 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
41681 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
41682 if (ret_conv_12_conv_10_var.is_owned) {
41683 ret_conv_12_conv_10_ref |= 1;
41685 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
41687 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
41688 FREE(ret_conv_12_var.data);
41689 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
41692 FREE(ret_var.data);
41696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
41697 LDKRoute this_ptr_conv;
41698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41699 this_ptr_conv.is_owned = false;
41700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41701 LDKCVec_CVec_RouteHopZZ val_constr;
41702 val_constr.datalen = (*env)->GetArrayLength(env, val);
41703 if (val_constr.datalen > 0)
41704 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41706 val_constr.data = NULL;
41707 for (size_t m = 0; m < val_constr.datalen; m++) {
41708 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
41709 LDKCVec_RouteHopZ val_conv_12_constr;
41710 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
41711 if (val_conv_12_constr.datalen > 0)
41712 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41714 val_conv_12_constr.data = NULL;
41715 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
41716 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
41717 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
41718 LDKRouteHop val_conv_12_conv_10_conv;
41719 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
41720 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
41721 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
41722 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
41723 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
41725 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
41726 val_constr.data[m] = val_conv_12_constr;
41728 Route_set_paths(&this_ptr_conv, val_constr);
41731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41732 LDKRoute this_ptr_conv;
41733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41734 this_ptr_conv.is_owned = false;
41735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41736 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
41737 int64_t ret_ref = 0;
41738 if ((uintptr_t)ret_var.inner > 4096) {
41739 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41740 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41742 ret_ref = (uintptr_t)ret_var.inner;
41743 if (ret_var.is_owned) {
41750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41751 LDKRoute this_ptr_conv;
41752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41753 this_ptr_conv.is_owned = false;
41754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41755 LDKPaymentParameters val_conv;
41756 val_conv.inner = (void*)(val & (~1));
41757 val_conv.is_owned = (val & 1) || (val == 0);
41758 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41759 val_conv = PaymentParameters_clone(&val_conv);
41760 Route_set_payment_params(&this_ptr_conv, val_conv);
41763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
41764 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
41765 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
41766 if (paths_arg_constr.datalen > 0)
41767 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41769 paths_arg_constr.data = NULL;
41770 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
41771 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
41772 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
41773 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
41774 if (paths_arg_conv_12_constr.datalen > 0)
41775 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41777 paths_arg_conv_12_constr.data = NULL;
41778 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
41779 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
41780 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
41781 LDKRouteHop paths_arg_conv_12_conv_10_conv;
41782 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
41783 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
41784 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
41785 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
41786 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
41788 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
41789 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
41791 LDKPaymentParameters payment_params_arg_conv;
41792 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41793 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41794 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41795 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41796 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
41797 int64_t ret_ref = 0;
41798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41801 ret_ref = (uintptr_t)ret_var.inner;
41802 if (ret_var.is_owned) {
41808 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
41809 LDKRoute ret_var = Route_clone(arg);
41810 int64_t ret_ref = 0;
41811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41814 ret_ref = (uintptr_t)ret_var.inner;
41815 if (ret_var.is_owned) {
41820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41822 arg_conv.inner = (void*)(arg & (~1));
41823 arg_conv.is_owned = false;
41824 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41825 int64_t ret_val = Route_clone_ptr(&arg_conv);
41829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41830 LDKRoute orig_conv;
41831 orig_conv.inner = (void*)(orig & (~1));
41832 orig_conv.is_owned = false;
41833 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41834 LDKRoute ret_var = Route_clone(&orig_conv);
41835 int64_t ret_ref = 0;
41836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41839 ret_ref = (uintptr_t)ret_var.inner;
41840 if (ret_var.is_owned) {
41846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
41848 o_conv.inner = (void*)(o & (~1));
41849 o_conv.is_owned = false;
41850 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41851 int64_t ret_val = Route_hash(&o_conv);
41855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41857 a_conv.inner = (void*)(a & (~1));
41858 a_conv.is_owned = false;
41859 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41861 b_conv.inner = (void*)(b & (~1));
41862 b_conv.is_owned = false;
41863 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41864 jboolean ret_val = Route_eq(&a_conv, &b_conv);
41868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
41869 LDKRoute this_arg_conv;
41870 this_arg_conv.inner = (void*)(this_arg & (~1));
41871 this_arg_conv.is_owned = false;
41872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41873 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
41877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
41878 LDKRoute this_arg_conv;
41879 this_arg_conv.inner = (void*)(this_arg & (~1));
41880 this_arg_conv.is_owned = false;
41881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41882 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
41886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
41888 obj_conv.inner = (void*)(obj & (~1));
41889 obj_conv.is_owned = false;
41890 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41891 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
41892 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41893 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41894 CVec_u8Z_free(ret_var);
41898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41899 LDKu8slice ser_ref;
41900 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41901 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41902 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
41903 *ret_conv = Route_read(ser_ref);
41904 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41905 return (int64_t)ret_conv;
41908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41909 LDKRouteParameters this_obj_conv;
41910 this_obj_conv.inner = (void*)(this_obj & (~1));
41911 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41913 RouteParameters_free(this_obj_conv);
41916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41917 LDKRouteParameters this_ptr_conv;
41918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41919 this_ptr_conv.is_owned = false;
41920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41921 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
41922 int64_t ret_ref = 0;
41923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41926 ret_ref = (uintptr_t)ret_var.inner;
41927 if (ret_var.is_owned) {
41933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41934 LDKRouteParameters this_ptr_conv;
41935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41936 this_ptr_conv.is_owned = false;
41937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41938 LDKPaymentParameters val_conv;
41939 val_conv.inner = (void*)(val & (~1));
41940 val_conv.is_owned = (val & 1) || (val == 0);
41941 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41942 val_conv = PaymentParameters_clone(&val_conv);
41943 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
41946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41947 LDKRouteParameters this_ptr_conv;
41948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41949 this_ptr_conv.is_owned = false;
41950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41951 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
41955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41956 LDKRouteParameters this_ptr_conv;
41957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41958 this_ptr_conv.is_owned = false;
41959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41960 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
41963 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41964 LDKRouteParameters this_ptr_conv;
41965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41966 this_ptr_conv.is_owned = false;
41967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41968 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
41972 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) {
41973 LDKRouteParameters this_ptr_conv;
41974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41975 this_ptr_conv.is_owned = false;
41976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41977 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
41980 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) {
41981 LDKPaymentParameters payment_params_arg_conv;
41982 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41983 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41984 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41985 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41986 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
41987 int64_t ret_ref = 0;
41988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41991 ret_ref = (uintptr_t)ret_var.inner;
41992 if (ret_var.is_owned) {
41998 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
41999 LDKRouteParameters ret_var = RouteParameters_clone(arg);
42000 int64_t ret_ref = 0;
42001 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42002 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42004 ret_ref = (uintptr_t)ret_var.inner;
42005 if (ret_var.is_owned) {
42010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42011 LDKRouteParameters arg_conv;
42012 arg_conv.inner = (void*)(arg & (~1));
42013 arg_conv.is_owned = false;
42014 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42015 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
42019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42020 LDKRouteParameters orig_conv;
42021 orig_conv.inner = (void*)(orig & (~1));
42022 orig_conv.is_owned = false;
42023 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42024 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
42025 int64_t ret_ref = 0;
42026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42029 ret_ref = (uintptr_t)ret_var.inner;
42030 if (ret_var.is_owned) {
42036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42037 LDKRouteParameters obj_conv;
42038 obj_conv.inner = (void*)(obj & (~1));
42039 obj_conv.is_owned = false;
42040 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42041 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
42042 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42043 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42044 CVec_u8Z_free(ret_var);
42048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42049 LDKu8slice ser_ref;
42050 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42051 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42052 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
42053 *ret_conv = RouteParameters_read(ser_ref);
42054 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42055 return (int64_t)ret_conv;
42058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42059 LDKPaymentParameters this_obj_conv;
42060 this_obj_conv.inner = (void*)(this_obj & (~1));
42061 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42063 PaymentParameters_free(this_obj_conv);
42066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42067 LDKPaymentParameters this_ptr_conv;
42068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42069 this_ptr_conv.is_owned = false;
42070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42071 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42072 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
42076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42077 LDKPaymentParameters this_ptr_conv;
42078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42079 this_ptr_conv.is_owned = false;
42080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42081 LDKPublicKey val_ref;
42082 CHECK((*env)->GetArrayLength(env, val) == 33);
42083 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42084 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
42087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42088 LDKPaymentParameters this_ptr_conv;
42089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42090 this_ptr_conv.is_owned = false;
42091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42092 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
42093 int64_t ret_ref = 0;
42094 if ((uintptr_t)ret_var.inner > 4096) {
42095 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42096 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42098 ret_ref = (uintptr_t)ret_var.inner;
42099 if (ret_var.is_owned) {
42106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42107 LDKPaymentParameters this_ptr_conv;
42108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42109 this_ptr_conv.is_owned = false;
42110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42111 LDKInvoiceFeatures val_conv;
42112 val_conv.inner = (void*)(val & (~1));
42113 val_conv.is_owned = (val & 1) || (val == 0);
42114 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42115 val_conv = InvoiceFeatures_clone(&val_conv);
42116 PaymentParameters_set_features(&this_ptr_conv, val_conv);
42119 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
42120 LDKPaymentParameters this_ptr_conv;
42121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42122 this_ptr_conv.is_owned = false;
42123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42124 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
42125 int64_tArray ret_arr = NULL;
42126 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42127 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42128 for (size_t l = 0; l < ret_var.datalen; l++) {
42129 LDKRouteHint ret_conv_11_var = ret_var.data[l];
42130 int64_t ret_conv_11_ref = 0;
42131 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42132 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
42134 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
42135 if (ret_conv_11_var.is_owned) {
42136 ret_conv_11_ref |= 1;
42138 ret_arr_ptr[l] = ret_conv_11_ref;
42140 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42141 FREE(ret_var.data);
42145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42146 LDKPaymentParameters 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 LDKCVec_RouteHintZ val_constr;
42151 val_constr.datalen = (*env)->GetArrayLength(env, val);
42152 if (val_constr.datalen > 0)
42153 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42155 val_constr.data = NULL;
42156 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42157 for (size_t l = 0; l < val_constr.datalen; l++) {
42158 int64_t val_conv_11 = val_vals[l];
42159 LDKRouteHint val_conv_11_conv;
42160 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
42161 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
42162 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
42163 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
42164 val_constr.data[l] = val_conv_11_conv;
42166 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42167 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
42170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
42171 LDKPaymentParameters this_ptr_conv;
42172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42173 this_ptr_conv.is_owned = false;
42174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42175 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42176 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
42177 int64_t ret_ref = (uintptr_t)ret_copy;
42181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42182 LDKPaymentParameters this_ptr_conv;
42183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42184 this_ptr_conv.is_owned = false;
42185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42186 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42187 CHECK_ACCESS(val_ptr);
42188 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42189 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42190 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
42193 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42194 LDKPaymentParameters this_ptr_conv;
42195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42196 this_ptr_conv.is_owned = false;
42197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42198 int32_t ret_val = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
42202 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) {
42203 LDKPaymentParameters this_ptr_conv;
42204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42205 this_ptr_conv.is_owned = false;
42206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42207 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
42210 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) {
42211 LDKPublicKey payee_pubkey_arg_ref;
42212 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
42213 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
42214 LDKInvoiceFeatures features_arg_conv;
42215 features_arg_conv.inner = (void*)(features_arg & (~1));
42216 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
42217 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42218 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
42219 LDKCVec_RouteHintZ route_hints_arg_constr;
42220 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
42221 if (route_hints_arg_constr.datalen > 0)
42222 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42224 route_hints_arg_constr.data = NULL;
42225 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
42226 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
42227 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
42228 LDKRouteHint route_hints_arg_conv_11_conv;
42229 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
42230 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
42231 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
42232 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
42233 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
42235 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
42236 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
42237 CHECK_ACCESS(expiry_time_arg_ptr);
42238 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
42239 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
42240 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);
42241 int64_t ret_ref = 0;
42242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42245 ret_ref = (uintptr_t)ret_var.inner;
42246 if (ret_var.is_owned) {
42252 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
42253 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
42254 int64_t ret_ref = 0;
42255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42258 ret_ref = (uintptr_t)ret_var.inner;
42259 if (ret_var.is_owned) {
42264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42265 LDKPaymentParameters arg_conv;
42266 arg_conv.inner = (void*)(arg & (~1));
42267 arg_conv.is_owned = false;
42268 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42269 int64_t ret_val = PaymentParameters_clone_ptr(&arg_conv);
42273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42274 LDKPaymentParameters orig_conv;
42275 orig_conv.inner = (void*)(orig & (~1));
42276 orig_conv.is_owned = false;
42277 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42278 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
42279 int64_t ret_ref = 0;
42280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42283 ret_ref = (uintptr_t)ret_var.inner;
42284 if (ret_var.is_owned) {
42290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
42291 LDKPaymentParameters o_conv;
42292 o_conv.inner = (void*)(o & (~1));
42293 o_conv.is_owned = false;
42294 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42295 int64_t ret_val = PaymentParameters_hash(&o_conv);
42299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42300 LDKPaymentParameters a_conv;
42301 a_conv.inner = (void*)(a & (~1));
42302 a_conv.is_owned = false;
42303 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42304 LDKPaymentParameters b_conv;
42305 b_conv.inner = (void*)(b & (~1));
42306 b_conv.is_owned = false;
42307 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42308 jboolean ret_val = PaymentParameters_eq(&a_conv, &b_conv);
42312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42313 LDKPaymentParameters obj_conv;
42314 obj_conv.inner = (void*)(obj & (~1));
42315 obj_conv.is_owned = false;
42316 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42317 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
42318 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42319 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42320 CVec_u8Z_free(ret_var);
42324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42325 LDKu8slice ser_ref;
42326 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42327 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42328 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
42329 *ret_conv = PaymentParameters_read(ser_ref);
42330 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42331 return (int64_t)ret_conv;
42334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
42335 LDKPublicKey payee_pubkey_ref;
42336 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
42337 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
42338 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
42339 int64_t ret_ref = 0;
42340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42343 ret_ref = (uintptr_t)ret_var.inner;
42344 if (ret_var.is_owned) {
42350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
42351 LDKPublicKey payee_pubkey_ref;
42352 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
42353 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
42354 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
42355 int64_t ret_ref = 0;
42356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42359 ret_ref = (uintptr_t)ret_var.inner;
42360 if (ret_var.is_owned) {
42366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42367 LDKRouteHint this_obj_conv;
42368 this_obj_conv.inner = (void*)(this_obj & (~1));
42369 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42371 RouteHint_free(this_obj_conv);
42374 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
42375 LDKRouteHint this_ptr_conv;
42376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42377 this_ptr_conv.is_owned = false;
42378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42379 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
42380 int64_tArray ret_arr = NULL;
42381 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42382 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42383 for (size_t o = 0; o < ret_var.datalen; o++) {
42384 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
42385 int64_t ret_conv_14_ref = 0;
42386 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42387 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
42389 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
42390 if (ret_conv_14_var.is_owned) {
42391 ret_conv_14_ref |= 1;
42393 ret_arr_ptr[o] = ret_conv_14_ref;
42395 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42396 FREE(ret_var.data);
42400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42401 LDKRouteHint this_ptr_conv;
42402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42403 this_ptr_conv.is_owned = false;
42404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42405 LDKCVec_RouteHintHopZ val_constr;
42406 val_constr.datalen = (*env)->GetArrayLength(env, val);
42407 if (val_constr.datalen > 0)
42408 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42410 val_constr.data = NULL;
42411 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42412 for (size_t o = 0; o < val_constr.datalen; o++) {
42413 int64_t val_conv_14 = val_vals[o];
42414 LDKRouteHintHop val_conv_14_conv;
42415 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
42416 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
42417 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
42418 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
42419 val_constr.data[o] = val_conv_14_conv;
42421 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42422 RouteHint_set_a(&this_ptr_conv, val_constr);
42425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
42426 LDKCVec_RouteHintHopZ a_arg_constr;
42427 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
42428 if (a_arg_constr.datalen > 0)
42429 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42431 a_arg_constr.data = NULL;
42432 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
42433 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
42434 int64_t a_arg_conv_14 = a_arg_vals[o];
42435 LDKRouteHintHop a_arg_conv_14_conv;
42436 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
42437 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
42438 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
42439 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
42440 a_arg_constr.data[o] = a_arg_conv_14_conv;
42442 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
42443 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
42444 int64_t ret_ref = 0;
42445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42448 ret_ref = (uintptr_t)ret_var.inner;
42449 if (ret_var.is_owned) {
42455 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
42456 LDKRouteHint ret_var = RouteHint_clone(arg);
42457 int64_t ret_ref = 0;
42458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42461 ret_ref = (uintptr_t)ret_var.inner;
42462 if (ret_var.is_owned) {
42467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42468 LDKRouteHint arg_conv;
42469 arg_conv.inner = (void*)(arg & (~1));
42470 arg_conv.is_owned = false;
42471 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42472 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
42476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42477 LDKRouteHint orig_conv;
42478 orig_conv.inner = (void*)(orig & (~1));
42479 orig_conv.is_owned = false;
42480 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42481 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
42482 int64_t ret_ref = 0;
42483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42486 ret_ref = (uintptr_t)ret_var.inner;
42487 if (ret_var.is_owned) {
42493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
42494 LDKRouteHint o_conv;
42495 o_conv.inner = (void*)(o & (~1));
42496 o_conv.is_owned = false;
42497 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42498 int64_t ret_val = RouteHint_hash(&o_conv);
42502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42503 LDKRouteHint a_conv;
42504 a_conv.inner = (void*)(a & (~1));
42505 a_conv.is_owned = false;
42506 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42507 LDKRouteHint b_conv;
42508 b_conv.inner = (void*)(b & (~1));
42509 b_conv.is_owned = false;
42510 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42511 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
42515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
42516 LDKRouteHint obj_conv;
42517 obj_conv.inner = (void*)(obj & (~1));
42518 obj_conv.is_owned = false;
42519 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42520 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
42521 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42522 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42523 CVec_u8Z_free(ret_var);
42527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42528 LDKu8slice ser_ref;
42529 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42530 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42531 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
42532 *ret_conv = RouteHint_read(ser_ref);
42533 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42534 return (int64_t)ret_conv;
42537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42538 LDKRouteHintHop this_obj_conv;
42539 this_obj_conv.inner = (void*)(this_obj & (~1));
42540 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42542 RouteHintHop_free(this_obj_conv);
42545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42546 LDKRouteHintHop this_ptr_conv;
42547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42548 this_ptr_conv.is_owned = false;
42549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42550 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42551 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
42555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42556 LDKRouteHintHop this_ptr_conv;
42557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42558 this_ptr_conv.is_owned = false;
42559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42560 LDKPublicKey val_ref;
42561 CHECK((*env)->GetArrayLength(env, val) == 33);
42562 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42563 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
42566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42567 LDKRouteHintHop this_ptr_conv;
42568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42569 this_ptr_conv.is_owned = false;
42570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42571 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
42575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42576 LDKRouteHintHop this_ptr_conv;
42577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42578 this_ptr_conv.is_owned = false;
42579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42580 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
42583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
42584 LDKRouteHintHop this_ptr_conv;
42585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42586 this_ptr_conv.is_owned = false;
42587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42588 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
42589 int64_t ret_ref = 0;
42590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42593 ret_ref = (uintptr_t)ret_var.inner;
42594 if (ret_var.is_owned) {
42600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42601 LDKRouteHintHop this_ptr_conv;
42602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42603 this_ptr_conv.is_owned = false;
42604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42605 LDKRoutingFees val_conv;
42606 val_conv.inner = (void*)(val & (~1));
42607 val_conv.is_owned = (val & 1) || (val == 0);
42608 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42609 val_conv = RoutingFees_clone(&val_conv);
42610 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
42613 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42614 LDKRouteHintHop this_ptr_conv;
42615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42616 this_ptr_conv.is_owned = false;
42617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42618 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
42622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42623 LDKRouteHintHop this_ptr_conv;
42624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42625 this_ptr_conv.is_owned = false;
42626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42627 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42631 LDKRouteHintHop this_ptr_conv;
42632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42633 this_ptr_conv.is_owned = false;
42634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42635 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42636 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
42637 int64_t ret_ref = (uintptr_t)ret_copy;
42641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42642 LDKRouteHintHop this_ptr_conv;
42643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42644 this_ptr_conv.is_owned = false;
42645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42646 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42647 CHECK_ACCESS(val_ptr);
42648 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42649 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42650 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
42653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42654 LDKRouteHintHop this_ptr_conv;
42655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42656 this_ptr_conv.is_owned = false;
42657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42658 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42659 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
42660 int64_t ret_ref = (uintptr_t)ret_copy;
42664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42665 LDKRouteHintHop this_ptr_conv;
42666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42667 this_ptr_conv.is_owned = false;
42668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42669 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42670 CHECK_ACCESS(val_ptr);
42671 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42672 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42673 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42676 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) {
42677 LDKPublicKey src_node_id_arg_ref;
42678 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
42679 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
42680 LDKRoutingFees fees_arg_conv;
42681 fees_arg_conv.inner = (void*)(fees_arg & (~1));
42682 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
42683 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42684 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42685 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
42686 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
42687 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
42688 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
42689 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
42690 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42691 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42692 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
42693 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);
42694 int64_t ret_ref = 0;
42695 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42696 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42698 ret_ref = (uintptr_t)ret_var.inner;
42699 if (ret_var.is_owned) {
42705 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
42706 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
42707 int64_t ret_ref = 0;
42708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42711 ret_ref = (uintptr_t)ret_var.inner;
42712 if (ret_var.is_owned) {
42717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42718 LDKRouteHintHop arg_conv;
42719 arg_conv.inner = (void*)(arg & (~1));
42720 arg_conv.is_owned = false;
42721 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42722 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
42726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42727 LDKRouteHintHop orig_conv;
42728 orig_conv.inner = (void*)(orig & (~1));
42729 orig_conv.is_owned = false;
42730 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42731 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
42732 int64_t ret_ref = 0;
42733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42736 ret_ref = (uintptr_t)ret_var.inner;
42737 if (ret_var.is_owned) {
42743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
42744 LDKRouteHintHop o_conv;
42745 o_conv.inner = (void*)(o & (~1));
42746 o_conv.is_owned = false;
42747 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42748 int64_t ret_val = RouteHintHop_hash(&o_conv);
42752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42753 LDKRouteHintHop a_conv;
42754 a_conv.inner = (void*)(a & (~1));
42755 a_conv.is_owned = false;
42756 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42757 LDKRouteHintHop b_conv;
42758 b_conv.inner = (void*)(b & (~1));
42759 b_conv.is_owned = false;
42760 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42761 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
42765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
42766 LDKRouteHintHop obj_conv;
42767 obj_conv.inner = (void*)(obj & (~1));
42768 obj_conv.is_owned = false;
42769 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42770 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
42771 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42772 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42773 CVec_u8Z_free(ret_var);
42777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42778 LDKu8slice ser_ref;
42779 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42780 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42781 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
42782 *ret_conv = RouteHintHop_read(ser_ref);
42783 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42784 return (int64_t)ret_conv;
42787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer, int8_tArray random_seed_bytes) {
42788 LDKPublicKey our_node_pubkey_ref;
42789 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
42790 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
42791 LDKRouteParameters route_params_conv;
42792 route_params_conv.inner = (void*)(route_params & (~1));
42793 route_params_conv.is_owned = false;
42794 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42795 LDKNetworkGraph network_conv;
42796 network_conv.inner = (void*)(network & (~1));
42797 network_conv.is_owned = false;
42798 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
42799 LDKCVec_ChannelDetailsZ first_hops_constr;
42800 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
42801 if (first_hops != NULL) {
42802 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
42803 if (first_hops_constr.datalen > 0)
42804 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42806 first_hops_constr.data = NULL;
42807 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
42808 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
42809 int64_t first_hops_conv_16 = first_hops_vals[q];
42810 LDKChannelDetails first_hops_conv_16_conv;
42811 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
42812 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
42813 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
42814 first_hops_constr.data[q] = first_hops_conv_16_conv;
42816 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
42817 first_hops_ptr = &first_hops_constr;
42819 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42820 CHECK_ACCESS(logger_ptr);
42821 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42822 if (logger_conv.free == LDKLogger_JCalls_free) {
42823 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42824 LDKLogger_JCalls_cloned(&logger_conv);
42826 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
42827 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
42828 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
42829 unsigned char random_seed_bytes_arr[32];
42830 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
42831 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
42832 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42833 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42834 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
42835 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
42836 return (int64_t)ret_conv;
42839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42840 if ((this_ptr & 1) != 0) return;
42841 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42842 CHECK_ACCESS(this_ptr_ptr);
42843 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
42844 FREE((void*)this_ptr);
42845 Score_free(this_ptr_conv);
42848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42849 if ((this_ptr & 1) != 0) return;
42850 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42851 CHECK_ACCESS(this_ptr_ptr);
42852 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
42853 FREE((void*)this_ptr);
42854 LockableScore_free(this_ptr_conv);
42857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42858 LDKMultiThreadedLockableScore this_obj_conv;
42859 this_obj_conv.inner = (void*)(this_obj & (~1));
42860 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42862 MultiThreadedLockableScore_free(this_obj_conv);
42865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
42866 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
42867 CHECK_ACCESS(score_ptr);
42868 LDKScore score_conv = *(LDKScore*)(score_ptr);
42869 if (score_conv.free == LDKScore_JCalls_free) {
42870 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42871 LDKScore_JCalls_cloned(&score_conv);
42873 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
42874 int64_t ret_ref = 0;
42875 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42876 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42878 ret_ref = (uintptr_t)ret_var.inner;
42879 if (ret_var.is_owned) {
42885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42886 LDKFixedPenaltyScorer this_obj_conv;
42887 this_obj_conv.inner = (void*)(this_obj & (~1));
42888 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42890 FixedPenaltyScorer_free(this_obj_conv);
42893 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
42894 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
42895 int64_t ret_ref = 0;
42896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42899 ret_ref = (uintptr_t)ret_var.inner;
42900 if (ret_var.is_owned) {
42905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42906 LDKFixedPenaltyScorer arg_conv;
42907 arg_conv.inner = (void*)(arg & (~1));
42908 arg_conv.is_owned = false;
42909 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42910 int64_t ret_val = FixedPenaltyScorer_clone_ptr(&arg_conv);
42914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42915 LDKFixedPenaltyScorer orig_conv;
42916 orig_conv.inner = (void*)(orig & (~1));
42917 orig_conv.is_owned = false;
42918 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42919 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
42920 int64_t ret_ref = 0;
42921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42924 ret_ref = (uintptr_t)ret_var.inner;
42925 if (ret_var.is_owned) {
42931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
42932 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
42933 int64_t ret_ref = 0;
42934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42937 ret_ref = (uintptr_t)ret_var.inner;
42938 if (ret_var.is_owned) {
42944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
42945 LDKFixedPenaltyScorer this_arg_conv;
42946 this_arg_conv.inner = (void*)(this_arg & (~1));
42947 this_arg_conv.is_owned = false;
42948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42949 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42950 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
42951 return (int64_t)ret_ret;
42954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
42955 LDKFixedPenaltyScorer obj_conv;
42956 obj_conv.inner = (void*)(obj & (~1));
42957 obj_conv.is_owned = false;
42958 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42959 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
42960 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42961 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42962 CVec_u8Z_free(ret_var);
42966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
42967 LDKu8slice ser_ref;
42968 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42969 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42970 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
42971 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
42972 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42973 return (int64_t)ret_conv;
42976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42977 LDKScorer this_obj_conv;
42978 this_obj_conv.inner = (void*)(this_obj & (~1));
42979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42981 Scorer_free(this_obj_conv);
42984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42985 LDKScoringParameters this_obj_conv;
42986 this_obj_conv.inner = (void*)(this_obj & (~1));
42987 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42989 ScoringParameters_free(this_obj_conv);
42992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42993 LDKScoringParameters this_ptr_conv;
42994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42995 this_ptr_conv.is_owned = false;
42996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42997 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
43001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43002 LDKScoringParameters this_ptr_conv;
43003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43004 this_ptr_conv.is_owned = false;
43005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43006 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
43009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43010 LDKScoringParameters this_ptr_conv;
43011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43012 this_ptr_conv.is_owned = false;
43013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43014 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
43018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43019 LDKScoringParameters this_ptr_conv;
43020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43021 this_ptr_conv.is_owned = false;
43022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43023 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
43026 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
43027 LDKScoringParameters this_ptr_conv;
43028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43029 this_ptr_conv.is_owned = false;
43030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43031 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
43035 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) {
43036 LDKScoringParameters this_ptr_conv;
43037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43038 this_ptr_conv.is_owned = false;
43039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43040 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
43043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
43044 LDKScoringParameters this_ptr_conv;
43045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43046 this_ptr_conv.is_owned = false;
43047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43048 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
43052 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) {
43053 LDKScoringParameters this_ptr_conv;
43054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43055 this_ptr_conv.is_owned = false;
43056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43057 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
43060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
43061 LDKScoringParameters this_ptr_conv;
43062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43063 this_ptr_conv.is_owned = false;
43064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43065 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
43069 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) {
43070 LDKScoringParameters this_ptr_conv;
43071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43072 this_ptr_conv.is_owned = false;
43073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43074 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
43077 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) {
43078 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);
43079 int64_t ret_ref = 0;
43080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43083 ret_ref = (uintptr_t)ret_var.inner;
43084 if (ret_var.is_owned) {
43090 static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) {
43091 LDKScoringParameters ret_var = ScoringParameters_clone(arg);
43092 int64_t ret_ref = 0;
43093 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43094 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43096 ret_ref = (uintptr_t)ret_var.inner;
43097 if (ret_var.is_owned) {
43102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43103 LDKScoringParameters arg_conv;
43104 arg_conv.inner = (void*)(arg & (~1));
43105 arg_conv.is_owned = false;
43106 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43107 int64_t ret_val = ScoringParameters_clone_ptr(&arg_conv);
43111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43112 LDKScoringParameters orig_conv;
43113 orig_conv.inner = (void*)(orig & (~1));
43114 orig_conv.is_owned = false;
43115 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43116 LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv);
43117 int64_t ret_ref = 0;
43118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43121 ret_ref = (uintptr_t)ret_var.inner;
43122 if (ret_var.is_owned) {
43128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
43129 LDKScoringParameters obj_conv;
43130 obj_conv.inner = (void*)(obj & (~1));
43131 obj_conv.is_owned = false;
43132 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43133 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
43134 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43135 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43136 CVec_u8Z_free(ret_var);
43140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43141 LDKu8slice ser_ref;
43142 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43143 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43144 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
43145 *ret_conv = ScoringParameters_read(ser_ref);
43146 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43147 return (int64_t)ret_conv;
43150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) {
43151 LDKScoringParameters params_conv;
43152 params_conv.inner = (void*)(params & (~1));
43153 params_conv.is_owned = (params & 1) || (params == 0);
43154 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43155 params_conv = ScoringParameters_clone(¶ms_conv);
43156 LDKScorer ret_var = Scorer_new(params_conv);
43157 int64_t ret_ref = 0;
43158 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43159 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43161 ret_ref = (uintptr_t)ret_var.inner;
43162 if (ret_var.is_owned) {
43168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
43169 LDKScorer ret_var = Scorer_default();
43170 int64_t ret_ref = 0;
43171 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43172 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43174 ret_ref = (uintptr_t)ret_var.inner;
43175 if (ret_var.is_owned) {
43181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) {
43182 LDKScoringParameters ret_var = ScoringParameters_default();
43183 int64_t ret_ref = 0;
43184 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43185 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43187 ret_ref = (uintptr_t)ret_var.inner;
43188 if (ret_var.is_owned) {
43194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
43195 LDKScorer this_arg_conv;
43196 this_arg_conv.inner = (void*)(this_arg & (~1));
43197 this_arg_conv.is_owned = false;
43198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43199 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43200 *ret_ret = Scorer_as_Score(&this_arg_conv);
43201 return (int64_t)ret_ret;
43204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
43205 LDKScorer obj_conv;
43206 obj_conv.inner = (void*)(obj & (~1));
43207 obj_conv.is_owned = false;
43208 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43209 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
43210 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43211 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43212 CVec_u8Z_free(ret_var);
43216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43217 LDKu8slice ser_ref;
43218 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43219 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43220 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
43221 *ret_conv = Scorer_read(ser_ref);
43222 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43223 return (int64_t)ret_conv;
43226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43227 LDKProbabilisticScorer this_obj_conv;
43228 this_obj_conv.inner = (void*)(this_obj & (~1));
43229 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43231 ProbabilisticScorer_free(this_obj_conv);
43234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43235 LDKProbabilisticScoringParameters this_obj_conv;
43236 this_obj_conv.inner = (void*)(this_obj & (~1));
43237 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43239 ProbabilisticScoringParameters_free(this_obj_conv);
43242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43243 LDKProbabilisticScoringParameters this_ptr_conv;
43244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43245 this_ptr_conv.is_owned = false;
43246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43247 int64_t ret_val = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
43251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43252 LDKProbabilisticScoringParameters this_ptr_conv;
43253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43254 this_ptr_conv.is_owned = false;
43255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43256 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
43259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43260 LDKProbabilisticScoringParameters this_ptr_conv;
43261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43262 this_ptr_conv.is_owned = false;
43263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43264 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
43268 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) {
43269 LDKProbabilisticScoringParameters this_ptr_conv;
43270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43271 this_ptr_conv.is_owned = false;
43272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43273 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
43276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
43277 LDKProbabilisticScoringParameters this_ptr_conv;
43278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43279 this_ptr_conv.is_owned = false;
43280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43281 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
43285 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) {
43286 LDKProbabilisticScoringParameters this_ptr_conv;
43287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43288 this_ptr_conv.is_owned = false;
43289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43290 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
43293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43294 LDKProbabilisticScoringParameters this_ptr_conv;
43295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43296 this_ptr_conv.is_owned = false;
43297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43298 int64_t ret_val = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv);
43302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43303 LDKProbabilisticScoringParameters this_ptr_conv;
43304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43305 this_ptr_conv.is_owned = false;
43306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43307 ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val);
43310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg, int64_t amount_penalty_multiplier_msat_arg) {
43311 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg);
43312 int64_t ret_ref = 0;
43313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43316 ret_ref = (uintptr_t)ret_var.inner;
43317 if (ret_var.is_owned) {
43323 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
43324 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
43325 int64_t ret_ref = 0;
43326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43329 ret_ref = (uintptr_t)ret_var.inner;
43330 if (ret_var.is_owned) {
43335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43336 LDKProbabilisticScoringParameters arg_conv;
43337 arg_conv.inner = (void*)(arg & (~1));
43338 arg_conv.is_owned = false;
43339 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43340 int64_t ret_val = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
43344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43345 LDKProbabilisticScoringParameters orig_conv;
43346 orig_conv.inner = (void*)(orig & (~1));
43347 orig_conv.is_owned = false;
43348 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43349 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
43350 int64_t ret_ref = 0;
43351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43354 ret_ref = (uintptr_t)ret_var.inner;
43355 if (ret_var.is_owned) {
43361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph) {
43362 LDKProbabilisticScoringParameters params_conv;
43363 params_conv.inner = (void*)(params & (~1));
43364 params_conv.is_owned = (params & 1) || (params == 0);
43365 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43366 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
43367 LDKNetworkGraph network_graph_conv;
43368 network_graph_conv.inner = (void*)(network_graph & (~1));
43369 network_graph_conv.is_owned = false;
43370 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43371 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv);
43372 int64_t ret_ref = 0;
43373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43376 ret_ref = (uintptr_t)ret_var.inner;
43377 if (ret_var.is_owned) {
43383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
43384 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
43385 int64_t ret_ref = 0;
43386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43389 ret_ref = (uintptr_t)ret_var.inner;
43390 if (ret_var.is_owned) {
43396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
43397 LDKProbabilisticScorer this_arg_conv;
43398 this_arg_conv.inner = (void*)(this_arg & (~1));
43399 this_arg_conv.is_owned = false;
43400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43401 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43402 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
43403 return (int64_t)ret_ret;
43406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
43407 LDKProbabilisticScorer obj_conv;
43408 obj_conv.inner = (void*)(obj & (~1));
43409 obj_conv.is_owned = false;
43410 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43411 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
43412 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43413 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43414 CVec_u8Z_free(ret_var);
43418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
43419 LDKu8slice ser_ref;
43420 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43421 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43422 LDKProbabilisticScoringParameters arg_a_conv;
43423 arg_a_conv.inner = (void*)(arg_a & (~1));
43424 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
43425 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
43426 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
43427 LDKNetworkGraph arg_b_conv;
43428 arg_b_conv.inner = (void*)(arg_b & (~1));
43429 arg_b_conv.is_owned = false;
43430 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
43431 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
43432 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv);
43433 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43434 return (int64_t)ret_conv;
43437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43438 LDKFilesystemPersister this_obj_conv;
43439 this_obj_conv.inner = (void*)(this_obj & (~1));
43440 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43442 FilesystemPersister_free(this_obj_conv);
43445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
43446 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
43447 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
43448 int64_t ret_ref = 0;
43449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43452 ret_ref = (uintptr_t)ret_var.inner;
43453 if (ret_var.is_owned) {
43459 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
43460 LDKFilesystemPersister this_arg_conv;
43461 this_arg_conv.inner = (void*)(this_arg & (~1));
43462 this_arg_conv.is_owned = false;
43463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43464 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
43465 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
43470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
43471 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
43472 LDKChannelManager manager_conv;
43473 manager_conv.inner = (void*)(manager & (~1));
43474 manager_conv.is_owned = false;
43475 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
43476 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43477 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
43478 return (int64_t)ret_conv;
43481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1network_1graph(JNIEnv *env, jclass clz, jstring data_dir, int64_t network_graph) {
43482 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
43483 LDKNetworkGraph network_graph_conv;
43484 network_graph_conv.inner = (void*)(network_graph & (~1));
43485 network_graph_conv.is_owned = false;
43486 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43487 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43488 *ret_conv = FilesystemPersister_persist_network_graph(data_dir_conv, &network_graph_conv);
43489 return (int64_t)ret_conv;
43492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
43493 LDKFilesystemPersister this_arg_conv;
43494 this_arg_conv.inner = (void*)(this_arg & (~1));
43495 this_arg_conv.is_owned = false;
43496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43497 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
43498 CHECK_ACCESS(keys_manager_ptr);
43499 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43500 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43501 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43502 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43504 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
43505 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
43506 return (int64_t)ret_conv;
43509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
43510 LDKFilesystemPersister this_arg_conv;
43511 this_arg_conv.inner = (void*)(this_arg & (~1));
43512 this_arg_conv.is_owned = false;
43513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43514 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
43515 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
43516 return (int64_t)ret_ret;
43519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43520 LDKBackgroundProcessor this_obj_conv;
43521 this_obj_conv.inner = (void*)(this_obj & (~1));
43522 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43524 BackgroundProcessor_free(this_obj_conv);
43527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43528 if ((this_ptr & 1) != 0) return;
43529 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43530 CHECK_ACCESS(this_ptr_ptr);
43531 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
43532 FREE((void*)this_ptr);
43533 Persister_free(this_ptr_conv);
43536 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) {
43537 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
43538 CHECK_ACCESS(persister_ptr);
43539 LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
43540 if (persister_conv.free == LDKPersister_JCalls_free) {
43541 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43542 LDKPersister_JCalls_cloned(&persister_conv);
43544 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
43545 CHECK_ACCESS(event_handler_ptr);
43546 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
43547 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
43548 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43549 LDKEventHandler_JCalls_cloned(&event_handler_conv);
43551 LDKChainMonitor chain_monitor_conv;
43552 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
43553 chain_monitor_conv.is_owned = false;
43554 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
43555 LDKChannelManager channel_manager_conv;
43556 channel_manager_conv.inner = (void*)(channel_manager & (~1));
43557 channel_manager_conv.is_owned = false;
43558 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
43559 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
43560 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
43561 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
43562 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
43563 LDKPeerManager peer_manager_conv;
43564 peer_manager_conv.inner = (void*)(peer_manager & (~1));
43565 peer_manager_conv.is_owned = false;
43566 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
43567 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43568 CHECK_ACCESS(logger_ptr);
43569 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43570 if (logger_conv.free == LDKLogger_JCalls_free) {
43571 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43572 LDKLogger_JCalls_cloned(&logger_conv);
43574 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);
43575 int64_t ret_ref = 0;
43576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43579 ret_ref = (uintptr_t)ret_var.inner;
43580 if (ret_var.is_owned) {
43586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
43587 LDKBackgroundProcessor this_arg_conv;
43588 this_arg_conv.inner = (void*)(this_arg & (~1));
43589 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43591 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
43592 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43593 *ret_conv = BackgroundProcessor_join(this_arg_conv);
43594 return (int64_t)ret_conv;
43597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
43598 LDKBackgroundProcessor this_arg_conv;
43599 this_arg_conv.inner = (void*)(this_arg & (~1));
43600 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43602 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
43603 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43604 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
43605 return (int64_t)ret_conv;
43608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43609 if ((this_ptr & 1) != 0) return;
43610 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43611 CHECK_ACCESS(this_ptr_ptr);
43612 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
43613 FREE((void*)this_ptr);
43614 ParseError_free(this_ptr_conv);
43617 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
43618 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43619 *ret_copy = ParseError_clone(arg);
43620 int64_t ret_ref = (uintptr_t)ret_copy;
43623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43624 LDKParseError* arg_conv = (LDKParseError*)arg;
43625 int64_t ret_val = ParseError_clone_ptr(arg_conv);
43629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43630 LDKParseError* orig_conv = (LDKParseError*)orig;
43631 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43632 *ret_copy = ParseError_clone(orig_conv);
43633 int64_t ret_ref = (uintptr_t)ret_copy;
43637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
43638 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
43639 CHECK_ACCESS(a_ptr);
43640 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
43641 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
43642 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43643 *ret_copy = ParseError_bech32_error(a_conv);
43644 int64_t ret_ref = (uintptr_t)ret_copy;
43648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
43650 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43651 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
43652 int64_t ret_ref = (uintptr_t)ret_copy;
43656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
43657 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
43658 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43659 *ret_copy = ParseError_malformed_signature(a_conv);
43660 int64_t ret_ref = (uintptr_t)ret_copy;
43664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
43665 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43666 *ret_copy = ParseError_bad_prefix();
43667 int64_t ret_ref = (uintptr_t)ret_copy;
43671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
43672 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43673 *ret_copy = ParseError_unknown_currency();
43674 int64_t ret_ref = (uintptr_t)ret_copy;
43678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
43679 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43680 *ret_copy = ParseError_unknown_si_prefix();
43681 int64_t ret_ref = (uintptr_t)ret_copy;
43685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
43686 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43687 *ret_copy = ParseError_malformed_hrp();
43688 int64_t ret_ref = (uintptr_t)ret_copy;
43692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
43693 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43694 *ret_copy = ParseError_too_short_data_part();
43695 int64_t ret_ref = (uintptr_t)ret_copy;
43699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
43700 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43701 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
43702 int64_t ret_ref = (uintptr_t)ret_copy;
43706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
43708 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43709 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
43710 int64_t ret_ref = (uintptr_t)ret_copy;
43714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
43715 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43716 *ret_copy = ParseError_padding_error();
43717 int64_t ret_ref = (uintptr_t)ret_copy;
43721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
43722 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43723 *ret_copy = ParseError_integer_overflow_error();
43724 int64_t ret_ref = (uintptr_t)ret_copy;
43728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
43729 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43730 *ret_copy = ParseError_invalid_seg_wit_program_length();
43731 int64_t ret_ref = (uintptr_t)ret_copy;
43735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
43736 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43737 *ret_copy = ParseError_invalid_pub_key_hash_length();
43738 int64_t ret_ref = (uintptr_t)ret_copy;
43742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
43743 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43744 *ret_copy = ParseError_invalid_script_hash_length();
43745 int64_t ret_ref = (uintptr_t)ret_copy;
43749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
43750 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43751 *ret_copy = ParseError_invalid_recovery_id();
43752 int64_t ret_ref = (uintptr_t)ret_copy;
43756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
43757 LDKStr a_conv = java_to_owned_str(env, a);
43758 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43759 *ret_copy = ParseError_invalid_slice_length(a_conv);
43760 int64_t ret_ref = (uintptr_t)ret_copy;
43764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
43765 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43766 *ret_copy = ParseError_skip();
43767 int64_t ret_ref = (uintptr_t)ret_copy;
43771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43772 if ((this_ptr & 1) != 0) return;
43773 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43774 CHECK_ACCESS(this_ptr_ptr);
43775 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
43776 FREE((void*)this_ptr);
43777 ParseOrSemanticError_free(this_ptr_conv);
43780 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
43781 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43782 *ret_copy = ParseOrSemanticError_clone(arg);
43783 int64_t ret_ref = (uintptr_t)ret_copy;
43786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43787 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
43788 int64_t ret_val = ParseOrSemanticError_clone_ptr(arg_conv);
43792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43793 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
43794 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43795 *ret_copy = ParseOrSemanticError_clone(orig_conv);
43796 int64_t ret_ref = (uintptr_t)ret_copy;
43800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
43801 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
43802 CHECK_ACCESS(a_ptr);
43803 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
43804 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
43805 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43806 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
43807 int64_t ret_ref = (uintptr_t)ret_copy;
43811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
43812 LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
43813 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43814 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
43815 int64_t ret_ref = (uintptr_t)ret_copy;
43819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43820 LDKInvoice this_obj_conv;
43821 this_obj_conv.inner = (void*)(this_obj & (~1));
43822 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43824 Invoice_free(this_obj_conv);
43827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43829 a_conv.inner = (void*)(a & (~1));
43830 a_conv.is_owned = false;
43831 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43833 b_conv.inner = (void*)(b & (~1));
43834 b_conv.is_owned = false;
43835 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43836 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
43840 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
43841 LDKInvoice ret_var = Invoice_clone(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) {
43852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43853 LDKInvoice arg_conv;
43854 arg_conv.inner = (void*)(arg & (~1));
43855 arg_conv.is_owned = false;
43856 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43857 int64_t ret_val = Invoice_clone_ptr(&arg_conv);
43861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43862 LDKInvoice orig_conv;
43863 orig_conv.inner = (void*)(orig & (~1));
43864 orig_conv.is_owned = false;
43865 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43866 LDKInvoice ret_var = Invoice_clone(&orig_conv);
43867 int64_t ret_ref = 0;
43868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43871 ret_ref = (uintptr_t)ret_var.inner;
43872 if (ret_var.is_owned) {
43878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43879 LDKSignedRawInvoice this_obj_conv;
43880 this_obj_conv.inner = (void*)(this_obj & (~1));
43881 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43883 SignedRawInvoice_free(this_obj_conv);
43886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43887 LDKSignedRawInvoice a_conv;
43888 a_conv.inner = (void*)(a & (~1));
43889 a_conv.is_owned = false;
43890 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43891 LDKSignedRawInvoice b_conv;
43892 b_conv.inner = (void*)(b & (~1));
43893 b_conv.is_owned = false;
43894 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43895 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
43899 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
43900 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
43901 int64_t ret_ref = 0;
43902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43905 ret_ref = (uintptr_t)ret_var.inner;
43906 if (ret_var.is_owned) {
43911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43912 LDKSignedRawInvoice arg_conv;
43913 arg_conv.inner = (void*)(arg & (~1));
43914 arg_conv.is_owned = false;
43915 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43916 int64_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
43920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43921 LDKSignedRawInvoice orig_conv;
43922 orig_conv.inner = (void*)(orig & (~1));
43923 orig_conv.is_owned = false;
43924 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43925 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
43926 int64_t ret_ref = 0;
43927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43930 ret_ref = (uintptr_t)ret_var.inner;
43931 if (ret_var.is_owned) {
43937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43938 LDKRawInvoice this_obj_conv;
43939 this_obj_conv.inner = (void*)(this_obj & (~1));
43940 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43942 RawInvoice_free(this_obj_conv);
43945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
43946 LDKRawInvoice this_ptr_conv;
43947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43948 this_ptr_conv.is_owned = false;
43949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43950 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
43951 int64_t ret_ref = 0;
43952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43955 ret_ref = (uintptr_t)ret_var.inner;
43956 if (ret_var.is_owned) {
43962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43963 LDKRawInvoice this_ptr_conv;
43964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43965 this_ptr_conv.is_owned = false;
43966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43967 LDKRawDataPart val_conv;
43968 val_conv.inner = (void*)(val & (~1));
43969 val_conv.is_owned = (val & 1) || (val == 0);
43970 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43971 val_conv = RawDataPart_clone(&val_conv);
43972 RawInvoice_set_data(&this_ptr_conv, val_conv);
43975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43976 LDKRawInvoice a_conv;
43977 a_conv.inner = (void*)(a & (~1));
43978 a_conv.is_owned = false;
43979 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43980 LDKRawInvoice b_conv;
43981 b_conv.inner = (void*)(b & (~1));
43982 b_conv.is_owned = false;
43983 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43984 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
43988 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
43989 LDKRawInvoice ret_var = RawInvoice_clone(arg);
43990 int64_t ret_ref = 0;
43991 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43992 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43994 ret_ref = (uintptr_t)ret_var.inner;
43995 if (ret_var.is_owned) {
44000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44001 LDKRawInvoice arg_conv;
44002 arg_conv.inner = (void*)(arg & (~1));
44003 arg_conv.is_owned = false;
44004 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44005 int64_t ret_val = RawInvoice_clone_ptr(&arg_conv);
44009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44010 LDKRawInvoice orig_conv;
44011 orig_conv.inner = (void*)(orig & (~1));
44012 orig_conv.is_owned = false;
44013 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44014 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
44015 int64_t ret_ref = 0;
44016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44019 ret_ref = (uintptr_t)ret_var.inner;
44020 if (ret_var.is_owned) {
44026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44027 LDKRawDataPart this_obj_conv;
44028 this_obj_conv.inner = (void*)(this_obj & (~1));
44029 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44031 RawDataPart_free(this_obj_conv);
44034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
44035 LDKRawDataPart this_ptr_conv;
44036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44037 this_ptr_conv.is_owned = false;
44038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44039 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
44040 int64_t ret_ref = 0;
44041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44044 ret_ref = (uintptr_t)ret_var.inner;
44045 if (ret_var.is_owned) {
44051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44052 LDKRawDataPart this_ptr_conv;
44053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44054 this_ptr_conv.is_owned = false;
44055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44056 LDKPositiveTimestamp val_conv;
44057 val_conv.inner = (void*)(val & (~1));
44058 val_conv.is_owned = (val & 1) || (val == 0);
44059 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44060 val_conv = PositiveTimestamp_clone(&val_conv);
44061 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
44064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44065 LDKRawDataPart a_conv;
44066 a_conv.inner = (void*)(a & (~1));
44067 a_conv.is_owned = false;
44068 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44069 LDKRawDataPart b_conv;
44070 b_conv.inner = (void*)(b & (~1));
44071 b_conv.is_owned = false;
44072 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44073 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
44077 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
44078 LDKRawDataPart ret_var = RawDataPart_clone(arg);
44079 int64_t ret_ref = 0;
44080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44083 ret_ref = (uintptr_t)ret_var.inner;
44084 if (ret_var.is_owned) {
44089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44090 LDKRawDataPart arg_conv;
44091 arg_conv.inner = (void*)(arg & (~1));
44092 arg_conv.is_owned = false;
44093 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44094 int64_t ret_val = RawDataPart_clone_ptr(&arg_conv);
44098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44099 LDKRawDataPart orig_conv;
44100 orig_conv.inner = (void*)(orig & (~1));
44101 orig_conv.is_owned = false;
44102 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44103 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
44104 int64_t ret_ref = 0;
44105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44108 ret_ref = (uintptr_t)ret_var.inner;
44109 if (ret_var.is_owned) {
44115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44116 LDKPositiveTimestamp this_obj_conv;
44117 this_obj_conv.inner = (void*)(this_obj & (~1));
44118 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44120 PositiveTimestamp_free(this_obj_conv);
44123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44124 LDKPositiveTimestamp a_conv;
44125 a_conv.inner = (void*)(a & (~1));
44126 a_conv.is_owned = false;
44127 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44128 LDKPositiveTimestamp b_conv;
44129 b_conv.inner = (void*)(b & (~1));
44130 b_conv.is_owned = false;
44131 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44132 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
44136 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
44137 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
44138 int64_t ret_ref = 0;
44139 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44140 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44142 ret_ref = (uintptr_t)ret_var.inner;
44143 if (ret_var.is_owned) {
44148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44149 LDKPositiveTimestamp arg_conv;
44150 arg_conv.inner = (void*)(arg & (~1));
44151 arg_conv.is_owned = false;
44152 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44153 int64_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
44157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44158 LDKPositiveTimestamp orig_conv;
44159 orig_conv.inner = (void*)(orig & (~1));
44160 orig_conv.is_owned = false;
44161 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44162 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
44163 int64_t ret_ref = 0;
44164 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44165 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44167 ret_ref = (uintptr_t)ret_var.inner;
44168 if (ret_var.is_owned) {
44174 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44175 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
44176 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
44180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
44181 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
44185 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
44186 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
44190 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
44191 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
44195 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
44196 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
44200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44201 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
44202 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
44203 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
44207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
44208 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
44209 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
44213 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44214 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
44215 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
44219 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
44220 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
44224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
44225 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
44229 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
44230 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
44234 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
44235 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
44239 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
44240 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
44244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
44245 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
44246 int64_t ret_val = Currency_hash(o_conv);
44250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44251 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
44252 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
44253 jboolean ret_val = Currency_eq(a_conv, b_conv);
44257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44258 LDKSha256 this_obj_conv;
44259 this_obj_conv.inner = (void*)(this_obj & (~1));
44260 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44262 Sha256_free(this_obj_conv);
44265 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
44266 LDKSha256 ret_var = Sha256_clone(arg);
44267 int64_t ret_ref = 0;
44268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44271 ret_ref = (uintptr_t)ret_var.inner;
44272 if (ret_var.is_owned) {
44277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44278 LDKSha256 arg_conv;
44279 arg_conv.inner = (void*)(arg & (~1));
44280 arg_conv.is_owned = false;
44281 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44282 int64_t ret_val = Sha256_clone_ptr(&arg_conv);
44286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44287 LDKSha256 orig_conv;
44288 orig_conv.inner = (void*)(orig & (~1));
44289 orig_conv.is_owned = false;
44290 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44291 LDKSha256 ret_var = Sha256_clone(&orig_conv);
44292 int64_t ret_ref = 0;
44293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44296 ret_ref = (uintptr_t)ret_var.inner;
44297 if (ret_var.is_owned) {
44303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
44305 o_conv.inner = (void*)(o & (~1));
44306 o_conv.is_owned = false;
44307 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44308 int64_t ret_val = Sha256_hash(&o_conv);
44312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44314 a_conv.inner = (void*)(a & (~1));
44315 a_conv.is_owned = false;
44316 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44318 b_conv.inner = (void*)(b & (~1));
44319 b_conv.is_owned = false;
44320 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44321 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
44325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44326 LDKDescription this_obj_conv;
44327 this_obj_conv.inner = (void*)(this_obj & (~1));
44328 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44330 Description_free(this_obj_conv);
44333 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
44334 LDKDescription ret_var = Description_clone(arg);
44335 int64_t ret_ref = 0;
44336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44339 ret_ref = (uintptr_t)ret_var.inner;
44340 if (ret_var.is_owned) {
44345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44346 LDKDescription arg_conv;
44347 arg_conv.inner = (void*)(arg & (~1));
44348 arg_conv.is_owned = false;
44349 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44350 int64_t ret_val = Description_clone_ptr(&arg_conv);
44354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44355 LDKDescription orig_conv;
44356 orig_conv.inner = (void*)(orig & (~1));
44357 orig_conv.is_owned = false;
44358 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44359 LDKDescription ret_var = Description_clone(&orig_conv);
44360 int64_t ret_ref = 0;
44361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44364 ret_ref = (uintptr_t)ret_var.inner;
44365 if (ret_var.is_owned) {
44371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
44372 LDKDescription o_conv;
44373 o_conv.inner = (void*)(o & (~1));
44374 o_conv.is_owned = false;
44375 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44376 int64_t ret_val = Description_hash(&o_conv);
44380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44381 LDKDescription a_conv;
44382 a_conv.inner = (void*)(a & (~1));
44383 a_conv.is_owned = false;
44384 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44385 LDKDescription b_conv;
44386 b_conv.inner = (void*)(b & (~1));
44387 b_conv.is_owned = false;
44388 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44389 jboolean ret_val = Description_eq(&a_conv, &b_conv);
44393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44394 LDKPayeePubKey this_obj_conv;
44395 this_obj_conv.inner = (void*)(this_obj & (~1));
44396 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44398 PayeePubKey_free(this_obj_conv);
44401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44402 LDKPayeePubKey this_ptr_conv;
44403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44404 this_ptr_conv.is_owned = false;
44405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44406 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
44411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44412 LDKPayeePubKey this_ptr_conv;
44413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44414 this_ptr_conv.is_owned = false;
44415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44416 LDKPublicKey val_ref;
44417 CHECK((*env)->GetArrayLength(env, val) == 33);
44418 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44419 PayeePubKey_set_a(&this_ptr_conv, val_ref);
44422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
44423 LDKPublicKey a_arg_ref;
44424 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
44425 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
44426 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
44427 int64_t ret_ref = 0;
44428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44431 ret_ref = (uintptr_t)ret_var.inner;
44432 if (ret_var.is_owned) {
44438 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
44439 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
44440 int64_t ret_ref = 0;
44441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44444 ret_ref = (uintptr_t)ret_var.inner;
44445 if (ret_var.is_owned) {
44450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44451 LDKPayeePubKey arg_conv;
44452 arg_conv.inner = (void*)(arg & (~1));
44453 arg_conv.is_owned = false;
44454 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44455 int64_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
44459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44460 LDKPayeePubKey orig_conv;
44461 orig_conv.inner = (void*)(orig & (~1));
44462 orig_conv.is_owned = false;
44463 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44464 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
44465 int64_t ret_ref = 0;
44466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44469 ret_ref = (uintptr_t)ret_var.inner;
44470 if (ret_var.is_owned) {
44476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
44477 LDKPayeePubKey o_conv;
44478 o_conv.inner = (void*)(o & (~1));
44479 o_conv.is_owned = false;
44480 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44481 int64_t ret_val = PayeePubKey_hash(&o_conv);
44485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44486 LDKPayeePubKey a_conv;
44487 a_conv.inner = (void*)(a & (~1));
44488 a_conv.is_owned = false;
44489 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44490 LDKPayeePubKey b_conv;
44491 b_conv.inner = (void*)(b & (~1));
44492 b_conv.is_owned = false;
44493 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44494 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
44498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44499 LDKExpiryTime this_obj_conv;
44500 this_obj_conv.inner = (void*)(this_obj & (~1));
44501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44503 ExpiryTime_free(this_obj_conv);
44506 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
44507 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
44508 int64_t ret_ref = 0;
44509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44512 ret_ref = (uintptr_t)ret_var.inner;
44513 if (ret_var.is_owned) {
44518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44519 LDKExpiryTime arg_conv;
44520 arg_conv.inner = (void*)(arg & (~1));
44521 arg_conv.is_owned = false;
44522 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44523 int64_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
44527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44528 LDKExpiryTime orig_conv;
44529 orig_conv.inner = (void*)(orig & (~1));
44530 orig_conv.is_owned = false;
44531 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44532 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
44533 int64_t ret_ref = 0;
44534 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44535 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44537 ret_ref = (uintptr_t)ret_var.inner;
44538 if (ret_var.is_owned) {
44544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
44545 LDKExpiryTime o_conv;
44546 o_conv.inner = (void*)(o & (~1));
44547 o_conv.is_owned = false;
44548 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44549 int64_t ret_val = ExpiryTime_hash(&o_conv);
44553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44554 LDKExpiryTime a_conv;
44555 a_conv.inner = (void*)(a & (~1));
44556 a_conv.is_owned = false;
44557 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44558 LDKExpiryTime b_conv;
44559 b_conv.inner = (void*)(b & (~1));
44560 b_conv.is_owned = false;
44561 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44562 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
44566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44567 LDKMinFinalCltvExpiry this_obj_conv;
44568 this_obj_conv.inner = (void*)(this_obj & (~1));
44569 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44571 MinFinalCltvExpiry_free(this_obj_conv);
44574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44575 LDKMinFinalCltvExpiry this_ptr_conv;
44576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44577 this_ptr_conv.is_owned = false;
44578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44579 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
44583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44584 LDKMinFinalCltvExpiry this_ptr_conv;
44585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44586 this_ptr_conv.is_owned = false;
44587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44588 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
44591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
44592 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
44593 int64_t ret_ref = 0;
44594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44597 ret_ref = (uintptr_t)ret_var.inner;
44598 if (ret_var.is_owned) {
44604 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
44605 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
44606 int64_t ret_ref = 0;
44607 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44608 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44610 ret_ref = (uintptr_t)ret_var.inner;
44611 if (ret_var.is_owned) {
44616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44617 LDKMinFinalCltvExpiry arg_conv;
44618 arg_conv.inner = (void*)(arg & (~1));
44619 arg_conv.is_owned = false;
44620 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44621 int64_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
44625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44626 LDKMinFinalCltvExpiry orig_conv;
44627 orig_conv.inner = (void*)(orig & (~1));
44628 orig_conv.is_owned = false;
44629 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44630 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
44631 int64_t ret_ref = 0;
44632 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44633 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44635 ret_ref = (uintptr_t)ret_var.inner;
44636 if (ret_var.is_owned) {
44642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
44643 LDKMinFinalCltvExpiry o_conv;
44644 o_conv.inner = (void*)(o & (~1));
44645 o_conv.is_owned = false;
44646 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44647 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
44651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44652 LDKMinFinalCltvExpiry a_conv;
44653 a_conv.inner = (void*)(a & (~1));
44654 a_conv.is_owned = false;
44655 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44656 LDKMinFinalCltvExpiry b_conv;
44657 b_conv.inner = (void*)(b & (~1));
44658 b_conv.is_owned = false;
44659 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44660 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
44664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44665 if ((this_ptr & 1) != 0) return;
44666 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44667 CHECK_ACCESS(this_ptr_ptr);
44668 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
44669 FREE((void*)this_ptr);
44670 Fallback_free(this_ptr_conv);
44673 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
44674 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44675 *ret_copy = Fallback_clone(arg);
44676 int64_t ret_ref = (uintptr_t)ret_copy;
44679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44680 LDKFallback* arg_conv = (LDKFallback*)arg;
44681 int64_t ret_val = Fallback_clone_ptr(arg_conv);
44685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44686 LDKFallback* orig_conv = (LDKFallback*)orig;
44687 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44688 *ret_copy = Fallback_clone(orig_conv);
44689 int64_t ret_ref = (uintptr_t)ret_copy;
44693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
44695 LDKCVec_u8Z program_ref;
44696 program_ref.datalen = (*env)->GetArrayLength(env, program);
44697 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
44698 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
44699 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44700 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
44701 int64_t ret_ref = (uintptr_t)ret_copy;
44705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
44706 LDKTwentyBytes a_ref;
44707 CHECK((*env)->GetArrayLength(env, a) == 20);
44708 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
44709 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44710 *ret_copy = Fallback_pub_key_hash(a_ref);
44711 int64_t ret_ref = (uintptr_t)ret_copy;
44715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
44716 LDKTwentyBytes a_ref;
44717 CHECK((*env)->GetArrayLength(env, a) == 20);
44718 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
44719 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44720 *ret_copy = Fallback_script_hash(a_ref);
44721 int64_t ret_ref = (uintptr_t)ret_copy;
44725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
44726 LDKFallback* o_conv = (LDKFallback*)o;
44727 int64_t ret_val = Fallback_hash(o_conv);
44731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44732 LDKFallback* a_conv = (LDKFallback*)a;
44733 LDKFallback* b_conv = (LDKFallback*)b;
44734 jboolean ret_val = Fallback_eq(a_conv, b_conv);
44738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44739 LDKInvoiceSignature this_obj_conv;
44740 this_obj_conv.inner = (void*)(this_obj & (~1));
44741 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44743 InvoiceSignature_free(this_obj_conv);
44746 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
44747 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
44748 int64_t ret_ref = 0;
44749 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44750 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44752 ret_ref = (uintptr_t)ret_var.inner;
44753 if (ret_var.is_owned) {
44758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44759 LDKInvoiceSignature arg_conv;
44760 arg_conv.inner = (void*)(arg & (~1));
44761 arg_conv.is_owned = false;
44762 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44763 int64_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
44767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44768 LDKInvoiceSignature orig_conv;
44769 orig_conv.inner = (void*)(orig & (~1));
44770 orig_conv.is_owned = false;
44771 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44772 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
44773 int64_t ret_ref = 0;
44774 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44775 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44777 ret_ref = (uintptr_t)ret_var.inner;
44778 if (ret_var.is_owned) {
44784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44785 LDKInvoiceSignature a_conv;
44786 a_conv.inner = (void*)(a & (~1));
44787 a_conv.is_owned = false;
44788 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44789 LDKInvoiceSignature b_conv;
44790 b_conv.inner = (void*)(b & (~1));
44791 b_conv.is_owned = false;
44792 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44793 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
44797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44798 LDKPrivateRoute this_obj_conv;
44799 this_obj_conv.inner = (void*)(this_obj & (~1));
44800 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44802 PrivateRoute_free(this_obj_conv);
44805 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
44806 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
44807 int64_t ret_ref = 0;
44808 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44809 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44811 ret_ref = (uintptr_t)ret_var.inner;
44812 if (ret_var.is_owned) {
44817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44818 LDKPrivateRoute arg_conv;
44819 arg_conv.inner = (void*)(arg & (~1));
44820 arg_conv.is_owned = false;
44821 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44822 int64_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
44826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44827 LDKPrivateRoute orig_conv;
44828 orig_conv.inner = (void*)(orig & (~1));
44829 orig_conv.is_owned = false;
44830 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44831 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
44832 int64_t ret_ref = 0;
44833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44836 ret_ref = (uintptr_t)ret_var.inner;
44837 if (ret_var.is_owned) {
44843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
44844 LDKPrivateRoute o_conv;
44845 o_conv.inner = (void*)(o & (~1));
44846 o_conv.is_owned = false;
44847 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44848 int64_t ret_val = PrivateRoute_hash(&o_conv);
44852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44853 LDKPrivateRoute a_conv;
44854 a_conv.inner = (void*)(a & (~1));
44855 a_conv.is_owned = false;
44856 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44857 LDKPrivateRoute b_conv;
44858 b_conv.inner = (void*)(b & (~1));
44859 b_conv.is_owned = false;
44860 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44861 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
44865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
44866 LDKSignedRawInvoice this_arg_conv;
44867 this_arg_conv.inner = (void*)(this_arg & (~1));
44868 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44870 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
44871 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
44872 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
44873 return ((int64_t)ret_conv);
44876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
44877 LDKSignedRawInvoice this_arg_conv;
44878 this_arg_conv.inner = (void*)(this_arg & (~1));
44879 this_arg_conv.is_owned = false;
44880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44881 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
44882 int64_t ret_ref = 0;
44883 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44884 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44885 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44886 ret_ref = (uintptr_t)ret_var.inner;
44887 if (ret_var.is_owned) {
44893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44894 LDKSignedRawInvoice this_arg_conv;
44895 this_arg_conv.inner = (void*)(this_arg & (~1));
44896 this_arg_conv.is_owned = false;
44897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44898 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44899 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
44903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44904 LDKSignedRawInvoice this_arg_conv;
44905 this_arg_conv.inner = (void*)(this_arg & (~1));
44906 this_arg_conv.is_owned = false;
44907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44908 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
44909 int64_t ret_ref = 0;
44910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44913 ret_ref = (uintptr_t)ret_var.inner;
44914 if (ret_var.is_owned) {
44920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44921 LDKSignedRawInvoice this_arg_conv;
44922 this_arg_conv.inner = (void*)(this_arg & (~1));
44923 this_arg_conv.is_owned = false;
44924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44925 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
44926 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
44927 return (int64_t)ret_conv;
44930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44931 LDKSignedRawInvoice this_arg_conv;
44932 this_arg_conv.inner = (void*)(this_arg & (~1));
44933 this_arg_conv.is_owned = false;
44934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44935 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
44939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44940 LDKRawInvoice this_arg_conv;
44941 this_arg_conv.inner = (void*)(this_arg & (~1));
44942 this_arg_conv.is_owned = false;
44943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44944 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44945 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
44949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44950 LDKRawInvoice this_arg_conv;
44951 this_arg_conv.inner = (void*)(this_arg & (~1));
44952 this_arg_conv.is_owned = false;
44953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44954 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
44955 int64_t ret_ref = 0;
44956 if ((uintptr_t)ret_var.inner > 4096) {
44957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44960 ret_ref = (uintptr_t)ret_var.inner;
44961 if (ret_var.is_owned) {
44968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
44969 LDKRawInvoice this_arg_conv;
44970 this_arg_conv.inner = (void*)(this_arg & (~1));
44971 this_arg_conv.is_owned = false;
44972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44973 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
44974 int64_t ret_ref = 0;
44975 if ((uintptr_t)ret_var.inner > 4096) {
44976 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44977 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44979 ret_ref = (uintptr_t)ret_var.inner;
44980 if (ret_var.is_owned) {
44987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44988 LDKRawInvoice this_arg_conv;
44989 this_arg_conv.inner = (void*)(this_arg & (~1));
44990 this_arg_conv.is_owned = false;
44991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44992 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
44993 int64_t ret_ref = 0;
44994 if ((uintptr_t)ret_var.inner > 4096) {
44995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44998 ret_ref = (uintptr_t)ret_var.inner;
44999 if (ret_var.is_owned) {
45006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
45007 LDKRawInvoice this_arg_conv;
45008 this_arg_conv.inner = (void*)(this_arg & (~1));
45009 this_arg_conv.is_owned = false;
45010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45011 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
45012 int64_t ret_ref = 0;
45013 if ((uintptr_t)ret_var.inner > 4096) {
45014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45017 ret_ref = (uintptr_t)ret_var.inner;
45018 if (ret_var.is_owned) {
45025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
45026 LDKRawInvoice this_arg_conv;
45027 this_arg_conv.inner = (void*)(this_arg & (~1));
45028 this_arg_conv.is_owned = false;
45029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45030 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
45031 int64_t ret_ref = 0;
45032 if ((uintptr_t)ret_var.inner > 4096) {
45033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45036 ret_ref = (uintptr_t)ret_var.inner;
45037 if (ret_var.is_owned) {
45044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
45045 LDKRawInvoice this_arg_conv;
45046 this_arg_conv.inner = (void*)(this_arg & (~1));
45047 this_arg_conv.is_owned = false;
45048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45049 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
45050 int64_t ret_ref = 0;
45051 if ((uintptr_t)ret_var.inner > 4096) {
45052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45055 ret_ref = (uintptr_t)ret_var.inner;
45056 if (ret_var.is_owned) {
45063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45064 LDKRawInvoice this_arg_conv;
45065 this_arg_conv.inner = (void*)(this_arg & (~1));
45066 this_arg_conv.is_owned = false;
45067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45068 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45069 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
45073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
45074 LDKRawInvoice this_arg_conv;
45075 this_arg_conv.inner = (void*)(this_arg & (~1));
45076 this_arg_conv.is_owned = false;
45077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45078 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
45079 int64_t ret_ref = 0;
45080 if ((uintptr_t)ret_var.inner > 4096) {
45081 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45082 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45083 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45084 ret_ref = (uintptr_t)ret_var.inner;
45085 if (ret_var.is_owned) {
45092 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
45093 LDKRawInvoice this_arg_conv;
45094 this_arg_conv.inner = (void*)(this_arg & (~1));
45095 this_arg_conv.is_owned = false;
45096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45097 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
45098 int64_tArray ret_arr = NULL;
45099 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45100 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45101 for (size_t o = 0; o < ret_var.datalen; o++) {
45102 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45103 int64_t ret_conv_14_ref = 0;
45104 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45105 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45107 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
45108 if (ret_conv_14_var.is_owned) {
45109 ret_conv_14_ref |= 1;
45111 ret_arr_ptr[o] = ret_conv_14_ref;
45113 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45114 FREE(ret_var.data);
45118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
45119 LDKRawInvoice this_arg_conv;
45120 this_arg_conv.inner = (void*)(this_arg & (~1));
45121 this_arg_conv.is_owned = false;
45122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45123 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45124 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
45125 int64_t ret_ref = (uintptr_t)ret_copy;
45129 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
45130 LDKRawInvoice this_arg_conv;
45131 this_arg_conv.inner = (void*)(this_arg & (~1));
45132 this_arg_conv.is_owned = false;
45133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45134 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
45138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
45139 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45140 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
45141 return (int64_t)ret_conv;
45144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
45145 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45146 *ret_conv = PositiveTimestamp_from_system_time(time);
45147 return (int64_t)ret_conv;
45150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
45151 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45152 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
45153 return (int64_t)ret_conv;
45156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
45157 LDKPositiveTimestamp this_arg_conv;
45158 this_arg_conv.inner = (void*)(this_arg & (~1));
45159 this_arg_conv.is_owned = false;
45160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45161 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
45165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
45166 LDKPositiveTimestamp this_arg_conv;
45167 this_arg_conv.inner = (void*)(this_arg & (~1));
45168 this_arg_conv.is_owned = false;
45169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45170 int64_t ret_val = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
45174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
45175 LDKPositiveTimestamp this_arg_conv;
45176 this_arg_conv.inner = (void*)(this_arg & (~1));
45177 this_arg_conv.is_owned = false;
45178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45179 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
45183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
45184 LDKInvoice this_arg_conv;
45185 this_arg_conv.inner = (void*)(this_arg & (~1));
45186 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45188 this_arg_conv = Invoice_clone(&this_arg_conv);
45189 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
45190 int64_t ret_ref = 0;
45191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45194 ret_ref = (uintptr_t)ret_var.inner;
45195 if (ret_var.is_owned) {
45201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
45202 LDKInvoice this_arg_conv;
45203 this_arg_conv.inner = (void*)(this_arg & (~1));
45204 this_arg_conv.is_owned = false;
45205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45206 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
45207 *ret_conv = Invoice_check_signature(&this_arg_conv);
45208 return (int64_t)ret_conv;
45211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
45212 LDKSignedRawInvoice signed_invoice_conv;
45213 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
45214 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
45215 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
45216 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
45217 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
45218 *ret_conv = Invoice_from_signed(signed_invoice_conv);
45219 return (int64_t)ret_conv;
45222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
45223 LDKInvoice this_arg_conv;
45224 this_arg_conv.inner = (void*)(this_arg & (~1));
45225 this_arg_conv.is_owned = false;
45226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45227 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
45231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
45232 LDKInvoice this_arg_conv;
45233 this_arg_conv.inner = (void*)(this_arg & (~1));
45234 this_arg_conv.is_owned = false;
45235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45236 int64_t ret_val = Invoice_duration_since_epoch(&this_arg_conv);
45240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
45241 LDKInvoice this_arg_conv;
45242 this_arg_conv.inner = (void*)(this_arg & (~1));
45243 this_arg_conv.is_owned = false;
45244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45245 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45246 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
45250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45251 LDKInvoice this_arg_conv;
45252 this_arg_conv.inner = (void*)(this_arg & (~1));
45253 this_arg_conv.is_owned = false;
45254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45255 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45256 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
45260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45261 LDKInvoice this_arg_conv;
45262 this_arg_conv.inner = (void*)(this_arg & (~1));
45263 this_arg_conv.is_owned = false;
45264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45265 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45266 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
45270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
45271 LDKInvoice this_arg_conv;
45272 this_arg_conv.inner = (void*)(this_arg & (~1));
45273 this_arg_conv.is_owned = false;
45274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45275 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
45276 int64_t ret_ref = 0;
45277 if ((uintptr_t)ret_var.inner > 4096) {
45278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45281 ret_ref = (uintptr_t)ret_var.inner;
45282 if (ret_var.is_owned) {
45289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45290 LDKInvoice this_arg_conv;
45291 this_arg_conv.inner = (void*)(this_arg & (~1));
45292 this_arg_conv.is_owned = false;
45293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45294 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45295 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
45299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
45300 LDKInvoice this_arg_conv;
45301 this_arg_conv.inner = (void*)(this_arg & (~1));
45302 this_arg_conv.is_owned = false;
45303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45304 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
45308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
45309 LDKInvoice this_arg_conv;
45310 this_arg_conv.inner = (void*)(this_arg & (~1));
45311 this_arg_conv.is_owned = false;
45312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45313 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
45317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
45318 LDKInvoice this_arg_conv;
45319 this_arg_conv.inner = (void*)(this_arg & (~1));
45320 this_arg_conv.is_owned = false;
45321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45322 jboolean ret_val = Invoice_would_expire(&this_arg_conv, at_time);
45326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
45327 LDKInvoice this_arg_conv;
45328 this_arg_conv.inner = (void*)(this_arg & (~1));
45329 this_arg_conv.is_owned = false;
45330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45331 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
45335 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
45336 LDKInvoice this_arg_conv;
45337 this_arg_conv.inner = (void*)(this_arg & (~1));
45338 this_arg_conv.is_owned = false;
45339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45340 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
45341 int64_tArray ret_arr = NULL;
45342 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45343 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45344 for (size_t o = 0; o < ret_var.datalen; o++) {
45345 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45346 int64_t ret_conv_14_ref = 0;
45347 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45348 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45350 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
45351 if (ret_conv_14_var.is_owned) {
45352 ret_conv_14_ref |= 1;
45354 ret_arr_ptr[o] = ret_conv_14_ref;
45356 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45357 FREE(ret_var.data);
45361 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
45362 LDKInvoice this_arg_conv;
45363 this_arg_conv.inner = (void*)(this_arg & (~1));
45364 this_arg_conv.is_owned = false;
45365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45366 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
45367 int64_tArray ret_arr = NULL;
45368 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45369 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45370 for (size_t l = 0; l < ret_var.datalen; l++) {
45371 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45372 int64_t ret_conv_11_ref = 0;
45373 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45374 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45376 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
45377 if (ret_conv_11_var.is_owned) {
45378 ret_conv_11_ref |= 1;
45380 ret_arr_ptr[l] = ret_conv_11_ref;
45382 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45383 FREE(ret_var.data);
45387 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
45388 LDKInvoice this_arg_conv;
45389 this_arg_conv.inner = (void*)(this_arg & (~1));
45390 this_arg_conv.is_owned = false;
45391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45392 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
45396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
45397 LDKInvoice this_arg_conv;
45398 this_arg_conv.inner = (void*)(this_arg & (~1));
45399 this_arg_conv.is_owned = false;
45400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45401 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45402 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
45403 int64_t ret_ref = (uintptr_t)ret_copy;
45407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
45408 LDKStr description_conv = java_to_owned_str(env, description);
45409 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
45410 *ret_conv = Description_new(description_conv);
45411 return (int64_t)ret_conv;
45414 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
45415 LDKDescription this_arg_conv;
45416 this_arg_conv.inner = (void*)(this_arg & (~1));
45417 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45419 this_arg_conv = Description_clone(&this_arg_conv);
45420 LDKStr ret_str = Description_into_inner(this_arg_conv);
45421 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
45427 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
45428 int64_t ret_ref = 0;
45429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45432 ret_ref = (uintptr_t)ret_var.inner;
45433 if (ret_var.is_owned) {
45439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
45440 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
45441 int64_t ret_ref = 0;
45442 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45443 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45445 ret_ref = (uintptr_t)ret_var.inner;
45446 if (ret_var.is_owned) {
45452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
45453 LDKExpiryTime this_arg_conv;
45454 this_arg_conv.inner = (void*)(this_arg & (~1));
45455 this_arg_conv.is_owned = false;
45456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45457 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
45461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
45462 LDKExpiryTime this_arg_conv;
45463 this_arg_conv.inner = (void*)(this_arg & (~1));
45464 this_arg_conv.is_owned = false;
45465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45466 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
45470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
45471 LDKRouteHint hops_conv;
45472 hops_conv.inner = (void*)(hops & (~1));
45473 hops_conv.is_owned = (hops & 1) || (hops == 0);
45474 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
45475 hops_conv = RouteHint_clone(&hops_conv);
45476 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
45477 *ret_conv = PrivateRoute_new(hops_conv);
45478 return (int64_t)ret_conv;
45481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
45482 LDKPrivateRoute this_arg_conv;
45483 this_arg_conv.inner = (void*)(this_arg & (~1));
45484 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45486 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
45487 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
45488 int64_t ret_ref = 0;
45489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45492 ret_ref = (uintptr_t)ret_var.inner;
45493 if (ret_var.is_owned) {
45499 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45500 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
45501 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
45505 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
45506 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
45510 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
45511 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
45515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
45516 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
45520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
45521 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
45525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
45526 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
45530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45531 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
45532 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
45533 jboolean ret_val = CreationError_eq(a_conv, b_conv);
45537 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45538 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
45539 LDKStr ret_str = CreationError_to_str(o_conv);
45540 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45545 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45546 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
45547 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
45551 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
45552 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
45556 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
45557 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
45561 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
45562 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
45566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
45567 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
45571 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
45572 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
45576 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
45577 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
45581 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
45582 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
45586 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
45587 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
45591 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
45592 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
45596 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
45597 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
45601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45602 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
45603 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
45604 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
45608 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45609 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
45610 LDKStr ret_str = SemanticError_to_str(o_conv);
45611 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45617 if ((this_ptr & 1) != 0) return;
45618 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45619 CHECK_ACCESS(this_ptr_ptr);
45620 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
45621 FREE((void*)this_ptr);
45622 SignOrCreationError_free(this_ptr_conv);
45625 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
45626 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45627 *ret_copy = SignOrCreationError_clone(arg);
45628 int64_t ret_ref = (uintptr_t)ret_copy;
45631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45632 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
45633 int64_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
45637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45638 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
45639 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45640 *ret_copy = SignOrCreationError_clone(orig_conv);
45641 int64_t ret_ref = (uintptr_t)ret_copy;
45645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
45646 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45647 *ret_copy = SignOrCreationError_sign_error();
45648 int64_t ret_ref = (uintptr_t)ret_copy;
45652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
45653 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
45654 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45655 *ret_copy = SignOrCreationError_creation_error(a_conv);
45656 int64_t ret_ref = (uintptr_t)ret_copy;
45660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45661 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
45662 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
45663 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
45667 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45668 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
45669 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
45670 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45676 LDKInvoicePayer this_obj_conv;
45677 this_obj_conv.inner = (void*)(this_obj & (~1));
45678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45680 InvoicePayer_free(this_obj_conv);
45683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45684 if ((this_ptr & 1) != 0) return;
45685 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45686 CHECK_ACCESS(this_ptr_ptr);
45687 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
45688 FREE((void*)this_ptr);
45689 Payer_free(this_ptr_conv);
45692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45693 if ((this_ptr & 1) != 0) return;
45694 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45695 CHECK_ACCESS(this_ptr_ptr);
45696 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45697 FREE((void*)this_ptr);
45698 Router_free(this_ptr_conv);
45701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45702 LDKRetryAttempts this_obj_conv;
45703 this_obj_conv.inner = (void*)(this_obj & (~1));
45704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45706 RetryAttempts_free(this_obj_conv);
45709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45710 LDKRetryAttempts this_ptr_conv;
45711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45712 this_ptr_conv.is_owned = false;
45713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45714 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
45718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45719 LDKRetryAttempts this_ptr_conv;
45720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45721 this_ptr_conv.is_owned = false;
45722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45723 RetryAttempts_set_a(&this_ptr_conv, val);
45726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
45727 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
45728 int64_t ret_ref = 0;
45729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45732 ret_ref = (uintptr_t)ret_var.inner;
45733 if (ret_var.is_owned) {
45739 static inline uintptr_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
45740 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
45741 int64_t ret_ref = 0;
45742 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45743 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45745 ret_ref = (uintptr_t)ret_var.inner;
45746 if (ret_var.is_owned) {
45751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45752 LDKRetryAttempts arg_conv;
45753 arg_conv.inner = (void*)(arg & (~1));
45754 arg_conv.is_owned = false;
45755 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45756 int64_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
45760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45761 LDKRetryAttempts orig_conv;
45762 orig_conv.inner = (void*)(orig & (~1));
45763 orig_conv.is_owned = false;
45764 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45765 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
45766 int64_t ret_ref = 0;
45767 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45768 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45770 ret_ref = (uintptr_t)ret_var.inner;
45771 if (ret_var.is_owned) {
45777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45778 LDKRetryAttempts a_conv;
45779 a_conv.inner = (void*)(a & (~1));
45780 a_conv.is_owned = false;
45781 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45782 LDKRetryAttempts b_conv;
45783 b_conv.inner = (void*)(b & (~1));
45784 b_conv.is_owned = false;
45785 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45786 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
45790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) {
45791 LDKRetryAttempts o_conv;
45792 o_conv.inner = (void*)(o & (~1));
45793 o_conv.is_owned = false;
45794 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45795 int64_t ret_val = RetryAttempts_hash(&o_conv);
45799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45800 if ((this_ptr & 1) != 0) return;
45801 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45802 CHECK_ACCESS(this_ptr_ptr);
45803 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
45804 FREE((void*)this_ptr);
45805 PaymentError_free(this_ptr_conv);
45808 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
45809 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45810 *ret_copy = PaymentError_clone(arg);
45811 int64_t ret_ref = (uintptr_t)ret_copy;
45814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45815 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
45816 int64_t ret_val = PaymentError_clone_ptr(arg_conv);
45820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45821 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
45822 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45823 *ret_copy = PaymentError_clone(orig_conv);
45824 int64_t ret_ref = (uintptr_t)ret_copy;
45828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
45829 LDKStr a_conv = java_to_owned_str(env, a);
45830 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45831 *ret_copy = PaymentError_invoice(a_conv);
45832 int64_t ret_ref = (uintptr_t)ret_copy;
45836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
45837 LDKLightningError a_conv;
45838 a_conv.inner = (void*)(a & (~1));
45839 a_conv.is_owned = (a & 1) || (a == 0);
45840 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45841 a_conv = LightningError_clone(&a_conv);
45842 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45843 *ret_copy = PaymentError_routing(a_conv);
45844 int64_t ret_ref = (uintptr_t)ret_copy;
45848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
45849 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
45850 CHECK_ACCESS(a_ptr);
45851 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
45852 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
45853 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45854 *ret_copy = PaymentError_sending(a_conv);
45855 int64_t ret_ref = (uintptr_t)ret_copy;
45859 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) {
45860 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
45861 CHECK_ACCESS(payer_ptr);
45862 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
45863 if (payer_conv.free == LDKPayer_JCalls_free) {
45864 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45865 LDKPayer_JCalls_cloned(&payer_conv);
45867 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
45868 CHECK_ACCESS(router_ptr);
45869 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45870 if (router_conv.free == LDKRouter_JCalls_free) {
45871 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45872 LDKRouter_JCalls_cloned(&router_conv);
45874 LDKMultiThreadedLockableScore scorer_conv;
45875 scorer_conv.inner = (void*)(scorer & (~1));
45876 scorer_conv.is_owned = false;
45877 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45878 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45879 CHECK_ACCESS(logger_ptr);
45880 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45881 if (logger_conv.free == LDKLogger_JCalls_free) {
45882 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45883 LDKLogger_JCalls_cloned(&logger_conv);
45885 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
45886 CHECK_ACCESS(event_handler_ptr);
45887 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45888 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45889 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45890 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45892 LDKRetryAttempts retry_attempts_conv;
45893 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
45894 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
45895 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
45896 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
45897 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
45898 int64_t ret_ref = 0;
45899 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45900 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45902 ret_ref = (uintptr_t)ret_var.inner;
45903 if (ret_var.is_owned) {
45909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
45910 LDKInvoicePayer this_arg_conv;
45911 this_arg_conv.inner = (void*)(this_arg & (~1));
45912 this_arg_conv.is_owned = false;
45913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45914 LDKInvoice invoice_conv;
45915 invoice_conv.inner = (void*)(invoice & (~1));
45916 invoice_conv.is_owned = false;
45917 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45918 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45919 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
45920 return (int64_t)ret_conv;
45923 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) {
45924 LDKInvoicePayer this_arg_conv;
45925 this_arg_conv.inner = (void*)(this_arg & (~1));
45926 this_arg_conv.is_owned = false;
45927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45928 LDKInvoice invoice_conv;
45929 invoice_conv.inner = (void*)(invoice & (~1));
45930 invoice_conv.is_owned = false;
45931 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45932 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45933 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
45934 return (int64_t)ret_conv;
45937 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) {
45938 LDKInvoicePayer this_arg_conv;
45939 this_arg_conv.inner = (void*)(this_arg & (~1));
45940 this_arg_conv.is_owned = false;
45941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45942 LDKPublicKey pubkey_ref;
45943 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
45944 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
45945 LDKThirtyTwoBytes payment_preimage_ref;
45946 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
45947 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
45948 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45949 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
45950 return (int64_t)ret_conv;
45953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
45954 LDKInvoicePayer this_arg_conv;
45955 this_arg_conv.inner = (void*)(this_arg & (~1));
45956 this_arg_conv.is_owned = false;
45957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45958 unsigned char payment_hash_arr[32];
45959 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45960 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
45961 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
45962 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
45965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
45966 LDKInvoicePayer this_arg_conv;
45967 this_arg_conv.inner = (void*)(this_arg & (~1));
45968 this_arg_conv.is_owned = false;
45969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45970 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
45971 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
45972 return (int64_t)ret_ret;
45975 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) {
45976 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45977 CHECK_ACCESS(amt_msat_ptr);
45978 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45979 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45980 LDKStr description_conv = java_to_owned_str(env, description);
45981 LDKThirtyTwoBytes payment_hash_ref;
45982 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45983 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
45984 LDKThirtyTwoBytes payment_secret_ref;
45985 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
45986 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
45987 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
45988 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
45989 if (phantom_route_hints_constr.datalen > 0)
45990 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
45992 phantom_route_hints_constr.data = NULL;
45993 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
45994 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
45995 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
45996 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
45997 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
45998 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
45999 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
46000 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
46001 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
46003 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
46004 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46005 CHECK_ACCESS(keys_manager_ptr);
46006 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46007 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46008 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46009 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46011 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46012 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46013 *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);
46014 return (int64_t)ret_conv;
46017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t description_hash, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
46018 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46019 CHECK_ACCESS(amt_msat_ptr);
46020 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46021 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46022 LDKSha256 description_hash_conv;
46023 description_hash_conv.inner = (void*)(description_hash & (~1));
46024 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
46025 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46026 description_hash_conv = Sha256_clone(&description_hash_conv);
46027 LDKThirtyTwoBytes payment_hash_ref;
46028 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
46029 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
46030 LDKThirtyTwoBytes payment_secret_ref;
46031 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
46032 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
46033 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
46034 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
46035 if (phantom_route_hints_constr.datalen > 0)
46036 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
46038 phantom_route_hints_constr.data = NULL;
46039 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
46040 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
46041 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
46042 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
46043 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
46044 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
46045 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
46046 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
46047 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
46049 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
46050 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46051 CHECK_ACCESS(keys_manager_ptr);
46052 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46053 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46054 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46055 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46057 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46058 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46059 *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, description_hash_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv);
46060 return (int64_t)ret_conv;
46063 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) {
46064 LDKChannelManager channelmanager_conv;
46065 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46066 channelmanager_conv.is_owned = false;
46067 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46068 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46069 CHECK_ACCESS(keys_manager_ptr);
46070 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46071 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46072 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46073 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46075 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46076 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46077 CHECK_ACCESS(amt_msat_ptr);
46078 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46079 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46080 LDKStr description_conv = java_to_owned_str(env, description);
46081 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46082 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
46083 return (int64_t)ret_conv;
46086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash) {
46087 LDKChannelManager channelmanager_conv;
46088 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46089 channelmanager_conv.is_owned = false;
46090 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46091 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46092 CHECK_ACCESS(keys_manager_ptr);
46093 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46094 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46095 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46096 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46098 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46099 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46100 CHECK_ACCESS(amt_msat_ptr);
46101 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46102 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46103 LDKSha256 description_hash_conv;
46104 description_hash_conv.inner = (void*)(description_hash & (~1));
46105 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
46106 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46107 description_hash_conv = Sha256_clone(&description_hash_conv);
46108 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46109 *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv);
46110 return (int64_t)ret_conv;
46113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch) {
46114 LDKChannelManager channelmanager_conv;
46115 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46116 channelmanager_conv.is_owned = false;
46117 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46118 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46119 CHECK_ACCESS(keys_manager_ptr);
46120 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46121 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46122 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46123 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46125 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46126 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46127 CHECK_ACCESS(amt_msat_ptr);
46128 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46129 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46130 LDKSha256 description_hash_conv;
46131 description_hash_conv.inner = (void*)(description_hash & (~1));
46132 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
46133 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46134 description_hash_conv = Sha256_clone(&description_hash_conv);
46135 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46136 *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch);
46137 return (int64_t)ret_conv;
46140 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) {
46141 LDKChannelManager channelmanager_conv;
46142 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46143 channelmanager_conv.is_owned = false;
46144 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46145 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46146 CHECK_ACCESS(keys_manager_ptr);
46147 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46148 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46149 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46150 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46152 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46153 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46154 CHECK_ACCESS(amt_msat_ptr);
46155 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46156 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46157 LDKStr description_conv = java_to_owned_str(env, description);
46158 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46159 *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);
46160 return (int64_t)ret_conv;
46163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46164 LDKDefaultRouter this_obj_conv;
46165 this_obj_conv.inner = (void*)(this_obj & (~1));
46166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46168 DefaultRouter_free(this_obj_conv);
46171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
46172 LDKNetworkGraph network_graph_conv;
46173 network_graph_conv.inner = (void*)(network_graph & (~1));
46174 network_graph_conv.is_owned = false;
46175 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46176 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46177 CHECK_ACCESS(logger_ptr);
46178 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46179 if (logger_conv.free == LDKLogger_JCalls_free) {
46180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46181 LDKLogger_JCalls_cloned(&logger_conv);
46183 LDKThirtyTwoBytes random_seed_bytes_ref;
46184 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46185 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
46186 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
46187 int64_t ret_ref = 0;
46188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46191 ret_ref = (uintptr_t)ret_var.inner;
46192 if (ret_var.is_owned) {
46198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
46199 LDKDefaultRouter this_arg_conv;
46200 this_arg_conv.inner = (void*)(this_arg & (~1));
46201 this_arg_conv.is_owned = false;
46202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46203 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
46204 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
46205 return (int64_t)ret_ret;
46208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
46209 LDKChannelManager this_arg_conv;
46210 this_arg_conv.inner = (void*)(this_arg & (~1));
46211 this_arg_conv.is_owned = false;
46212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46213 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
46214 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
46215 return (int64_t)ret_ret;
46218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
46219 LDKStr s_conv = java_to_owned_str(env, s);
46220 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
46221 *ret_conv = SiPrefix_from_str(s_conv);
46222 return (int64_t)ret_conv;
46225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
46226 LDKStr s_conv = java_to_owned_str(env, s);
46227 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
46228 *ret_conv = Invoice_from_str(s_conv);
46229 return (int64_t)ret_conv;
46232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
46233 LDKStr s_conv = java_to_owned_str(env, s);
46234 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
46235 *ret_conv = SignedRawInvoice_from_str(s_conv);
46236 return (int64_t)ret_conv;
46239 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46240 LDKParseError* o_conv = (LDKParseError*)o;
46241 LDKStr ret_str = ParseError_to_str(o_conv);
46242 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46247 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46248 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
46249 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
46250 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46255 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46257 o_conv.inner = (void*)(o & (~1));
46258 o_conv.is_owned = false;
46259 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46260 LDKStr ret_str = Invoice_to_str(&o_conv);
46261 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46266 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46267 LDKSignedRawInvoice o_conv;
46268 o_conv.inner = (void*)(o & (~1));
46269 o_conv.is_owned = false;
46270 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46271 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
46272 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46277 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46278 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
46279 LDKStr ret_str = Currency_to_str(o_conv);
46280 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46285 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46286 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
46287 LDKStr ret_str = SiPrefix_to_str(o_conv);
46288 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);