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_InvalidSharedSecret;
683 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
684 case 7: return LDKSecp256k1Error_InvalidTweak;
685 case 8: return LDKSecp256k1Error_NotEnoughMemory;
686 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
687 case 10: return LDKSecp256k1Error_InvalidParityValue;
689 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
690 abort(); // Unreachable, but will let the compiler know we don't return here
692 static jclass Secp256k1Error_class = NULL;
693 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
694 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
695 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
696 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
697 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
698 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
699 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
700 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
701 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
702 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
703 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
704 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
705 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
706 CHECK(Secp256k1Error_class != NULL);
707 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
708 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
709 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
710 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
711 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
712 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
713 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
714 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
715 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
716 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
717 Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
718 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
719 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
720 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
721 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
722 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
723 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
724 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
725 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
726 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
727 Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
728 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
730 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
732 case LDKSecp256k1Error_IncorrectSignature:
733 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
734 case LDKSecp256k1Error_InvalidMessage:
735 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
736 case LDKSecp256k1Error_InvalidPublicKey:
737 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
738 case LDKSecp256k1Error_InvalidSignature:
739 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
740 case LDKSecp256k1Error_InvalidSecretKey:
741 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
742 case LDKSecp256k1Error_InvalidSharedSecret:
743 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
744 case LDKSecp256k1Error_InvalidRecoveryId:
745 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
746 case LDKSecp256k1Error_InvalidTweak:
747 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
748 case LDKSecp256k1Error_NotEnoughMemory:
749 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
750 case LDKSecp256k1Error_InvalidPublicKeySum:
751 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
752 case LDKSecp256k1Error_InvalidParityValue:
753 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
758 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
759 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
760 if (UNLIKELY((*env)->ExceptionCheck(env))) {
761 (*env)->ExceptionDescribe(env);
762 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
765 case 0: return LDKSemanticError_NoPaymentHash;
766 case 1: return LDKSemanticError_MultiplePaymentHashes;
767 case 2: return LDKSemanticError_NoDescription;
768 case 3: return LDKSemanticError_MultipleDescriptions;
769 case 4: return LDKSemanticError_NoPaymentSecret;
770 case 5: return LDKSemanticError_MultiplePaymentSecrets;
771 case 6: return LDKSemanticError_InvalidFeatures;
772 case 7: return LDKSemanticError_InvalidRecoveryId;
773 case 8: return LDKSemanticError_InvalidSignature;
774 case 9: return LDKSemanticError_ImpreciseAmount;
776 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
777 abort(); // Unreachable, but will let the compiler know we don't return here
779 static jclass SemanticError_class = NULL;
780 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
781 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
782 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
783 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
784 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
785 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
786 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
787 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
788 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
789 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
790 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
791 SemanticError_class = (*env)->NewGlobalRef(env, clz);
792 CHECK(SemanticError_class != NULL);
793 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
794 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
795 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
796 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
797 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
798 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
799 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
800 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
801 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
802 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
803 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
804 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
805 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
806 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
807 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
808 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
809 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
810 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
811 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
812 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
814 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
816 case LDKSemanticError_NoPaymentHash:
817 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
818 case LDKSemanticError_MultiplePaymentHashes:
819 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
820 case LDKSemanticError_NoDescription:
821 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
822 case LDKSemanticError_MultipleDescriptions:
823 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
824 case LDKSemanticError_NoPaymentSecret:
825 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
826 case LDKSemanticError_MultiplePaymentSecrets:
827 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
828 case LDKSemanticError_InvalidFeatures:
829 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
830 case LDKSemanticError_InvalidRecoveryId:
831 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
832 case LDKSemanticError_InvalidSignature:
833 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
834 case LDKSemanticError_ImpreciseAmount:
835 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
840 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
841 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
842 if (UNLIKELY((*env)->ExceptionCheck(env))) {
843 (*env)->ExceptionDescribe(env);
844 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
847 case 0: return LDKSiPrefix_Milli;
848 case 1: return LDKSiPrefix_Micro;
849 case 2: return LDKSiPrefix_Nano;
850 case 3: return LDKSiPrefix_Pico;
852 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
853 abort(); // Unreachable, but will let the compiler know we don't return here
855 static jclass SiPrefix_class = NULL;
856 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
857 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
858 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
859 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
860 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
861 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
862 CHECK(SiPrefix_class != NULL);
863 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
864 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
865 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
866 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
867 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
868 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
869 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
870 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
872 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
874 case LDKSiPrefix_Milli:
875 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
876 case LDKSiPrefix_Micro:
877 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
878 case LDKSiPrefix_Nano:
879 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
880 case LDKSiPrefix_Pico:
881 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
886 static jclass LDKBech32Error_MissingSeparator_class = NULL;
887 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
888 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
889 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
890 static jclass LDKBech32Error_InvalidLength_class = NULL;
891 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
892 static jclass LDKBech32Error_InvalidChar_class = NULL;
893 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
894 static jclass LDKBech32Error_InvalidData_class = NULL;
895 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
896 static jclass LDKBech32Error_InvalidPadding_class = NULL;
897 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
898 static jclass LDKBech32Error_MixedCase_class = NULL;
899 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
901 LDKBech32Error_MissingSeparator_class =
902 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
903 CHECK(LDKBech32Error_MissingSeparator_class != NULL);
904 LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
905 CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
906 LDKBech32Error_InvalidChecksum_class =
907 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
908 CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
909 LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
910 CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
911 LDKBech32Error_InvalidLength_class =
912 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
913 CHECK(LDKBech32Error_InvalidLength_class != NULL);
914 LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
915 CHECK(LDKBech32Error_InvalidLength_meth != NULL);
916 LDKBech32Error_InvalidChar_class =
917 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
918 CHECK(LDKBech32Error_InvalidChar_class != NULL);
919 LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
920 CHECK(LDKBech32Error_InvalidChar_meth != NULL);
921 LDKBech32Error_InvalidData_class =
922 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
923 CHECK(LDKBech32Error_InvalidData_class != NULL);
924 LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
925 CHECK(LDKBech32Error_InvalidData_meth != NULL);
926 LDKBech32Error_InvalidPadding_class =
927 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
928 CHECK(LDKBech32Error_InvalidPadding_class != NULL);
929 LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
930 CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
931 LDKBech32Error_MixedCase_class =
932 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
933 CHECK(LDKBech32Error_MixedCase_class != NULL);
934 LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
935 CHECK(LDKBech32Error_MixedCase_meth != NULL);
937 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
938 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
940 case LDKBech32Error_MissingSeparator: {
941 return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
943 case LDKBech32Error_InvalidChecksum: {
944 return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
946 case LDKBech32Error_InvalidLength: {
947 return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
949 case LDKBech32Error_InvalidChar: {
950 int32_t invalid_char_conv = obj->invalid_char;
951 return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
953 case LDKBech32Error_InvalidData: {
954 int8_t invalid_data_conv = obj->invalid_data;
955 return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
957 case LDKBech32Error_InvalidPadding: {
958 return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
960 case LDKBech32Error_MixedCase: {
961 return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
966 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
967 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
968 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
971 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) {
972 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
973 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
974 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
975 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
976 CVec_u8Z_free(ret_var);
980 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) {
981 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
982 int64_t ret_conv = TxOut_get_value(thing_conv);
986 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
987 CHECK(owner->result_ok);
988 return *owner->contents.result;
990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
991 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
992 CResult_NoneNoneZ_get_ok(owner_conv);
995 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
996 CHECK(!owner->result_ok);
997 return *owner->contents.err;
999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1000 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1001 CResult_NoneNoneZ_get_err(owner_conv);
1004 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1005 CHECK(owner->result_ok);
1006 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
1008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1009 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
1010 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1011 int64_t ret_ref = 0;
1012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1015 ret_ref = (uintptr_t)ret_var.inner;
1016 if (ret_var.is_owned) {
1022 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1023 CHECK(!owner->result_ok);
1024 return DecodeError_clone(&*owner->contents.err);
1026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1027 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
1028 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1029 int64_t ret_ref = 0;
1030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1033 ret_ref = (uintptr_t)ret_var.inner;
1034 if (ret_var.is_owned) {
1040 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1041 CHECK(owner->result_ok);
1042 return *owner->contents.result;
1044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1045 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1046 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1051 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1052 CHECK(!owner->result_ok);
1053 return *owner->contents.err;
1055 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1056 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1057 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1061 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1062 CHECK(owner->result_ok);
1063 return *owner->contents.result;
1065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1066 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1067 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1068 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1072 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1073 CHECK(!owner->result_ok);
1074 return *owner->contents.err;
1076 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1077 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1078 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1082 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1083 CHECK(owner->result_ok);
1084 return TxCreationKeys_clone(&*owner->contents.result);
1086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1087 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1088 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1089 int64_t ret_ref = 0;
1090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1093 ret_ref = (uintptr_t)ret_var.inner;
1094 if (ret_var.is_owned) {
1100 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1101 CHECK(!owner->result_ok);
1102 return DecodeError_clone(&*owner->contents.err);
1104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1105 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1106 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1107 int64_t ret_ref = 0;
1108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1111 ret_ref = (uintptr_t)ret_var.inner;
1112 if (ret_var.is_owned) {
1118 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1119 CHECK(owner->result_ok);
1120 return ChannelPublicKeys_clone(&*owner->contents.result);
1122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1123 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1124 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1125 int64_t ret_ref = 0;
1126 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1127 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1129 ret_ref = (uintptr_t)ret_var.inner;
1130 if (ret_var.is_owned) {
1136 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1137 CHECK(!owner->result_ok);
1138 return DecodeError_clone(&*owner->contents.err);
1140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1141 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1142 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1143 int64_t ret_ref = 0;
1144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1147 ret_ref = (uintptr_t)ret_var.inner;
1148 if (ret_var.is_owned) {
1154 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1155 CHECK(owner->result_ok);
1156 return TxCreationKeys_clone(&*owner->contents.result);
1158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1159 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1160 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1161 int64_t ret_ref = 0;
1162 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1163 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1165 ret_ref = (uintptr_t)ret_var.inner;
1166 if (ret_var.is_owned) {
1172 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1173 CHECK(!owner->result_ok);
1174 return *owner->contents.err;
1176 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1177 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1178 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1182 static jclass LDKCOption_u32Z_Some_class = NULL;
1183 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1184 static jclass LDKCOption_u32Z_None_class = NULL;
1185 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1187 LDKCOption_u32Z_Some_class =
1188 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1189 CHECK(LDKCOption_u32Z_Some_class != NULL);
1190 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1191 CHECK(LDKCOption_u32Z_Some_meth != NULL);
1192 LDKCOption_u32Z_None_class =
1193 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1194 CHECK(LDKCOption_u32Z_None_class != NULL);
1195 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1196 CHECK(LDKCOption_u32Z_None_meth != NULL);
1198 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1199 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
1201 case LDKCOption_u32Z_Some: {
1202 int32_t some_conv = obj->some;
1203 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1205 case LDKCOption_u32Z_None: {
1206 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1211 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1212 CHECK(owner->result_ok);
1213 return HTLCOutputInCommitment_clone(&*owner->contents.result);
1215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1216 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1217 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1218 int64_t ret_ref = 0;
1219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1222 ret_ref = (uintptr_t)ret_var.inner;
1223 if (ret_var.is_owned) {
1229 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1230 CHECK(!owner->result_ok);
1231 return DecodeError_clone(&*owner->contents.err);
1233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1234 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1235 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1236 int64_t ret_ref = 0;
1237 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1238 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1240 ret_ref = (uintptr_t)ret_var.inner;
1241 if (ret_var.is_owned) {
1247 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1248 CHECK(owner->result_ok);
1249 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1252 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1253 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1254 int64_t ret_ref = 0;
1255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1258 ret_ref = (uintptr_t)ret_var.inner;
1259 if (ret_var.is_owned) {
1265 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1266 CHECK(!owner->result_ok);
1267 return DecodeError_clone(&*owner->contents.err);
1269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1270 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1271 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1272 int64_t ret_ref = 0;
1273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1276 ret_ref = (uintptr_t)ret_var.inner;
1277 if (ret_var.is_owned) {
1283 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1284 CHECK(owner->result_ok);
1285 return ChannelTransactionParameters_clone(&*owner->contents.result);
1287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1288 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1289 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1290 int64_t ret_ref = 0;
1291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1294 ret_ref = (uintptr_t)ret_var.inner;
1295 if (ret_var.is_owned) {
1301 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1302 CHECK(!owner->result_ok);
1303 return DecodeError_clone(&*owner->contents.err);
1305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1306 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1307 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1308 int64_t ret_ref = 0;
1309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1312 ret_ref = (uintptr_t)ret_var.inner;
1313 if (ret_var.is_owned) {
1319 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1320 CHECK(owner->result_ok);
1321 return HolderCommitmentTransaction_clone(&*owner->contents.result);
1323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1324 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1325 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1326 int64_t ret_ref = 0;
1327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1330 ret_ref = (uintptr_t)ret_var.inner;
1331 if (ret_var.is_owned) {
1337 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1338 CHECK(!owner->result_ok);
1339 return DecodeError_clone(&*owner->contents.err);
1341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1342 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1343 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1344 int64_t ret_ref = 0;
1345 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1346 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1348 ret_ref = (uintptr_t)ret_var.inner;
1349 if (ret_var.is_owned) {
1355 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1356 CHECK(owner->result_ok);
1357 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1360 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1361 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1362 int64_t ret_ref = 0;
1363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1366 ret_ref = (uintptr_t)ret_var.inner;
1367 if (ret_var.is_owned) {
1373 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1374 CHECK(!owner->result_ok);
1375 return DecodeError_clone(&*owner->contents.err);
1377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1378 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1379 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1380 int64_t ret_ref = 0;
1381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1384 ret_ref = (uintptr_t)ret_var.inner;
1385 if (ret_var.is_owned) {
1391 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1392 CHECK(owner->result_ok);
1393 return &*owner->contents.result;
1395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1396 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1397 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1398 int64_t ret_ref = 0;
1399 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1400 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1402 ret_ref = (uintptr_t)ret_var.inner & ~1;
1406 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1407 CHECK(!owner->result_ok);
1408 return *owner->contents.err;
1410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1411 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1412 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1415 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1416 CHECK(owner->result_ok);
1417 return CommitmentTransaction_clone(&*owner->contents.result);
1419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1420 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1421 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1422 int64_t ret_ref = 0;
1423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1426 ret_ref = (uintptr_t)ret_var.inner;
1427 if (ret_var.is_owned) {
1433 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1434 CHECK(!owner->result_ok);
1435 return DecodeError_clone(&*owner->contents.err);
1437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1438 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1439 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1440 int64_t ret_ref = 0;
1441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1444 ret_ref = (uintptr_t)ret_var.inner;
1445 if (ret_var.is_owned) {
1451 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1452 CHECK(owner->result_ok);
1453 return &*owner->contents.result;
1455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1456 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1457 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1458 int64_t ret_ref = 0;
1459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1462 ret_ref = (uintptr_t)ret_var.inner & ~1;
1466 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1467 CHECK(!owner->result_ok);
1468 return *owner->contents.err;
1470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1471 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1472 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1475 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1476 CHECK(owner->result_ok);
1477 return *owner->contents.result;
1479 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1480 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1481 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1482 jobjectArray ret_arr = NULL;
1483 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1485 for (size_t i = 0; i < ret_var.datalen; i++) {
1486 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1487 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1488 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1494 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1495 CHECK(!owner->result_ok);
1496 return *owner->contents.err;
1498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1499 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1500 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1503 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1504 CHECK(owner->result_ok);
1505 return ShutdownScript_clone(&*owner->contents.result);
1507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1508 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1509 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1510 int64_t ret_ref = 0;
1511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1514 ret_ref = (uintptr_t)ret_var.inner;
1515 if (ret_var.is_owned) {
1521 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1522 CHECK(!owner->result_ok);
1523 return DecodeError_clone(&*owner->contents.err);
1525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1526 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1527 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1528 int64_t ret_ref = 0;
1529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1532 ret_ref = (uintptr_t)ret_var.inner;
1533 if (ret_var.is_owned) {
1539 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1540 CHECK(owner->result_ok);
1541 return ShutdownScript_clone(&*owner->contents.result);
1543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1544 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1545 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1546 int64_t ret_ref = 0;
1547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1550 ret_ref = (uintptr_t)ret_var.inner;
1551 if (ret_var.is_owned) {
1557 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1558 CHECK(!owner->result_ok);
1559 return InvalidShutdownScript_clone(&*owner->contents.err);
1561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1562 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1563 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1564 int64_t ret_ref = 0;
1565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1568 ret_ref = (uintptr_t)ret_var.inner;
1569 if (ret_var.is_owned) {
1575 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1576 CHECK(owner->result_ok);
1577 return *owner->contents.result;
1579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1580 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1581 CResult_NoneErrorZ_get_ok(owner_conv);
1584 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1585 CHECK(!owner->result_ok);
1586 return *owner->contents.err;
1588 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1589 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1590 jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1594 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1595 CHECK(owner->result_ok);
1596 return RouteHop_clone(&*owner->contents.result);
1598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1599 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1600 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1601 int64_t ret_ref = 0;
1602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1605 ret_ref = (uintptr_t)ret_var.inner;
1606 if (ret_var.is_owned) {
1612 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1613 CHECK(!owner->result_ok);
1614 return DecodeError_clone(&*owner->contents.err);
1616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1617 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1618 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1619 int64_t ret_ref = 0;
1620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1623 ret_ref = (uintptr_t)ret_var.inner;
1624 if (ret_var.is_owned) {
1630 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1631 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1632 for (size_t i = 0; i < ret.datalen; i++) {
1633 ret.data[i] = RouteHop_clone(&orig->data[i]);
1637 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1638 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1639 for (size_t i = 0; i < ret.datalen; i++) {
1640 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1644 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1645 CHECK(owner->result_ok);
1646 return Route_clone(&*owner->contents.result);
1648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1649 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1650 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1651 int64_t ret_ref = 0;
1652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1655 ret_ref = (uintptr_t)ret_var.inner;
1656 if (ret_var.is_owned) {
1662 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1663 CHECK(!owner->result_ok);
1664 return DecodeError_clone(&*owner->contents.err);
1666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1667 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1668 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1669 int64_t ret_ref = 0;
1670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1673 ret_ref = (uintptr_t)ret_var.inner;
1674 if (ret_var.is_owned) {
1680 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1681 CHECK(owner->result_ok);
1682 return RouteParameters_clone(&*owner->contents.result);
1684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1685 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1686 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1687 int64_t ret_ref = 0;
1688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1691 ret_ref = (uintptr_t)ret_var.inner;
1692 if (ret_var.is_owned) {
1698 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1699 CHECK(!owner->result_ok);
1700 return DecodeError_clone(&*owner->contents.err);
1702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1703 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1704 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1705 int64_t ret_ref = 0;
1706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1709 ret_ref = (uintptr_t)ret_var.inner;
1710 if (ret_var.is_owned) {
1716 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1717 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1718 for (size_t i = 0; i < ret.datalen; i++) {
1719 ret.data[i] = RouteHint_clone(&orig->data[i]);
1723 static jclass LDKCOption_u64Z_Some_class = NULL;
1724 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1725 static jclass LDKCOption_u64Z_None_class = NULL;
1726 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1728 LDKCOption_u64Z_Some_class =
1729 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1730 CHECK(LDKCOption_u64Z_Some_class != NULL);
1731 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1732 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1733 LDKCOption_u64Z_None_class =
1734 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1735 CHECK(LDKCOption_u64Z_None_class != NULL);
1736 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1737 CHECK(LDKCOption_u64Z_None_meth != NULL);
1739 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1740 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1742 case LDKCOption_u64Z_Some: {
1743 int64_t some_conv = obj->some;
1744 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1746 case LDKCOption_u64Z_None: {
1747 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1752 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1753 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1754 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1757 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1758 CHECK(owner->result_ok);
1759 return PaymentParameters_clone(&*owner->contents.result);
1761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1762 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1763 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1764 int64_t ret_ref = 0;
1765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1768 ret_ref = (uintptr_t)ret_var.inner;
1769 if (ret_var.is_owned) {
1775 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1776 CHECK(!owner->result_ok);
1777 return DecodeError_clone(&*owner->contents.err);
1779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1780 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1781 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1782 int64_t ret_ref = 0;
1783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1786 ret_ref = (uintptr_t)ret_var.inner;
1787 if (ret_var.is_owned) {
1793 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1794 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1795 for (size_t i = 0; i < ret.datalen; i++) {
1796 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1800 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1801 CHECK(owner->result_ok);
1802 return RouteHint_clone(&*owner->contents.result);
1804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1805 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1806 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1807 int64_t ret_ref = 0;
1808 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1809 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1811 ret_ref = (uintptr_t)ret_var.inner;
1812 if (ret_var.is_owned) {
1818 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1819 CHECK(!owner->result_ok);
1820 return DecodeError_clone(&*owner->contents.err);
1822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1823 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1824 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1825 int64_t ret_ref = 0;
1826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1829 ret_ref = (uintptr_t)ret_var.inner;
1830 if (ret_var.is_owned) {
1836 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1837 CHECK(owner->result_ok);
1838 return RouteHintHop_clone(&*owner->contents.result);
1840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1841 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1842 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1843 int64_t ret_ref = 0;
1844 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1845 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1847 ret_ref = (uintptr_t)ret_var.inner;
1848 if (ret_var.is_owned) {
1854 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1855 CHECK(!owner->result_ok);
1856 return DecodeError_clone(&*owner->contents.err);
1858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1859 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1860 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1861 int64_t ret_ref = 0;
1862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1865 ret_ref = (uintptr_t)ret_var.inner;
1866 if (ret_var.is_owned) {
1872 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1873 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1874 for (size_t i = 0; i < ret.datalen; i++) {
1875 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1879 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1880 CHECK(owner->result_ok);
1881 return Route_clone(&*owner->contents.result);
1883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1884 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1885 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1886 int64_t ret_ref = 0;
1887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1890 ret_ref = (uintptr_t)ret_var.inner;
1891 if (ret_var.is_owned) {
1897 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1898 CHECK(!owner->result_ok);
1899 return LightningError_clone(&*owner->contents.err);
1901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1902 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1903 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1904 int64_t ret_ref = 0;
1905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1908 ret_ref = (uintptr_t)ret_var.inner;
1909 if (ret_var.is_owned) {
1915 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
1916 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
1917 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
1918 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
1919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
1920 LDKPaymentPurpose_InvoicePayment_class =
1921 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
1922 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
1923 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
1924 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
1925 LDKPaymentPurpose_SpontaneousPayment_class =
1926 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
1927 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
1928 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
1929 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
1931 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1932 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1934 case LDKPaymentPurpose_InvoicePayment: {
1935 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1936 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
1937 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1938 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
1939 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
1941 case LDKPaymentPurpose_SpontaneousPayment: {
1942 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
1943 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
1944 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
1949 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1950 CHECK(owner->result_ok);
1951 return PaymentPurpose_clone(&*owner->contents.result);
1953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1954 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1955 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1956 *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1957 int64_t ret_ref = (uintptr_t)ret_copy;
1961 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1962 CHECK(!owner->result_ok);
1963 return DecodeError_clone(&*owner->contents.err);
1965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1966 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1967 LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1968 int64_t ret_ref = 0;
1969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1972 ret_ref = (uintptr_t)ret_var.inner;
1973 if (ret_var.is_owned) {
1979 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1980 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1981 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1982 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1983 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1984 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1985 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1986 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1987 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1988 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1989 static jclass LDKClosureReason_ProcessingError_class = NULL;
1990 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1991 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1992 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1993 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1994 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1996 LDKClosureReason_CounterpartyForceClosed_class =
1997 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
1998 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
1999 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2000 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2001 LDKClosureReason_HolderForceClosed_class =
2002 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2003 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2004 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2005 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2006 LDKClosureReason_CooperativeClosure_class =
2007 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2008 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2009 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2010 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2011 LDKClosureReason_CommitmentTxConfirmed_class =
2012 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2013 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2014 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2015 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2016 LDKClosureReason_FundingTimedOut_class =
2017 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2018 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2019 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2020 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2021 LDKClosureReason_ProcessingError_class =
2022 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2023 CHECK(LDKClosureReason_ProcessingError_class != NULL);
2024 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2025 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2026 LDKClosureReason_DisconnectedPeer_class =
2027 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2028 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2029 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2030 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2031 LDKClosureReason_OutdatedChannelManager_class =
2032 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2033 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2034 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2035 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2037 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2038 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
2040 case LDKClosureReason_CounterpartyForceClosed: {
2041 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2042 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2043 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2045 case LDKClosureReason_HolderForceClosed: {
2046 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2048 case LDKClosureReason_CooperativeClosure: {
2049 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2051 case LDKClosureReason_CommitmentTxConfirmed: {
2052 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2054 case LDKClosureReason_FundingTimedOut: {
2055 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2057 case LDKClosureReason_ProcessingError: {
2058 LDKStr err_str = obj->processing_error.err;
2059 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2060 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2062 case LDKClosureReason_DisconnectedPeer: {
2063 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2065 case LDKClosureReason_OutdatedChannelManager: {
2066 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2071 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2072 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2073 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2074 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2076 LDKCOption_ClosureReasonZ_Some_class =
2077 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2078 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2079 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2080 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2081 LDKCOption_ClosureReasonZ_None_class =
2082 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2083 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2084 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2085 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2087 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2088 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2090 case LDKCOption_ClosureReasonZ_Some: {
2091 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2092 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2094 case LDKCOption_ClosureReasonZ_None: {
2095 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2100 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2101 CHECK(owner->result_ok);
2102 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2105 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2106 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2107 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2108 int64_t ret_ref = (uintptr_t)ret_copy;
2112 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2113 CHECK(!owner->result_ok);
2114 return DecodeError_clone(&*owner->contents.err);
2116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2117 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2118 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2119 int64_t ret_ref = 0;
2120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2123 ret_ref = (uintptr_t)ret_var.inner;
2124 if (ret_var.is_owned) {
2130 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
2131 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
2132 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
2133 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
2134 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
2135 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
2136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
2137 LDKHTLCDestination_NextHopChannel_class =
2138 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
2139 CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
2140 LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
2141 CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
2142 LDKHTLCDestination_UnknownNextHop_class =
2143 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
2144 CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
2145 LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
2146 CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
2147 LDKHTLCDestination_FailedPayment_class =
2148 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
2149 CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
2150 LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
2151 CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
2153 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2154 LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
2156 case LDKHTLCDestination_NextHopChannel: {
2157 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2158 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
2159 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2160 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
2161 return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
2163 case LDKHTLCDestination_UnknownNextHop: {
2164 int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2165 return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
2167 case LDKHTLCDestination_FailedPayment: {
2168 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2169 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
2170 return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
2175 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
2176 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
2177 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
2178 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
2179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
2180 LDKCOption_HTLCDestinationZ_Some_class =
2181 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
2182 CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
2183 LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
2184 CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
2185 LDKCOption_HTLCDestinationZ_None_class =
2186 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
2187 CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
2188 LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
2189 CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
2191 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2192 LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)(ptr & ~1);
2194 case LDKCOption_HTLCDestinationZ_Some: {
2195 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2196 return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
2198 case LDKCOption_HTLCDestinationZ_None: {
2199 return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
2204 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2205 CHECK(owner->result_ok);
2206 return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2209 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
2210 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2211 *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
2212 int64_t ret_ref = (uintptr_t)ret_copy;
2216 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2217 CHECK(!owner->result_ok);
2218 return DecodeError_clone(&*owner->contents.err);
2220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2221 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
2222 LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2223 int64_t ret_ref = 0;
2224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2227 ret_ref = (uintptr_t)ret_var.inner;
2228 if (ret_var.is_owned) {
2234 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2235 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2236 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2237 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2238 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2239 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2241 LDKNetworkUpdate_ChannelUpdateMessage_class =
2242 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2243 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2244 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2245 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2246 LDKNetworkUpdate_ChannelFailure_class =
2247 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2248 CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2249 LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2250 CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2251 LDKNetworkUpdate_NodeFailure_class =
2252 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2253 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2254 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2255 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2257 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2258 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2260 case LDKNetworkUpdate_ChannelUpdateMessage: {
2261 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2262 int64_t msg_ref = 0;
2263 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2264 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2265 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2266 msg_ref = (uintptr_t)msg_var.inner & ~1;
2267 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2269 case LDKNetworkUpdate_ChannelFailure: {
2270 int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2271 jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2272 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2274 case LDKNetworkUpdate_NodeFailure: {
2275 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2276 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2277 jboolean is_permanent_conv = obj->node_failure.is_permanent;
2278 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2283 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2284 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2285 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2286 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2288 LDKCOption_NetworkUpdateZ_Some_class =
2289 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2290 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2291 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2292 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2293 LDKCOption_NetworkUpdateZ_None_class =
2294 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2295 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2296 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2297 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2299 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2300 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2302 case LDKCOption_NetworkUpdateZ_Some: {
2303 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2304 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2306 case LDKCOption_NetworkUpdateZ_None: {
2307 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2312 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2313 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2314 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2315 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2316 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2317 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2319 LDKSpendableOutputDescriptor_StaticOutput_class =
2320 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2321 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2322 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2323 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2324 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2325 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2326 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2327 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2328 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2329 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2330 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2331 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2332 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2333 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2335 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2336 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2338 case LDKSpendableOutputDescriptor_StaticOutput: {
2339 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2340 int64_t outpoint_ref = 0;
2341 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2342 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2343 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2344 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2345 int64_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2346 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (int64_t)output_ref);
2348 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2349 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2350 int64_t delayed_payment_output_ref = 0;
2351 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2352 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2353 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2354 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2355 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2357 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2358 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2359 int64_t static_payment_output_ref = 0;
2360 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2361 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2362 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2363 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2364 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2369 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2370 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2371 for (size_t i = 0; i < ret.datalen; i++) {
2372 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2376 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2377 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2378 static jclass LDKEvent_PaymentReceived_class = NULL;
2379 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2380 static jclass LDKEvent_PaymentClaimed_class = NULL;
2381 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
2382 static jclass LDKEvent_PaymentSent_class = NULL;
2383 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2384 static jclass LDKEvent_PaymentFailed_class = NULL;
2385 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2386 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2387 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2388 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2389 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2390 static jclass LDKEvent_ProbeSuccessful_class = NULL;
2391 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
2392 static jclass LDKEvent_ProbeFailed_class = NULL;
2393 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
2394 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2395 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2396 static jclass LDKEvent_SpendableOutputs_class = NULL;
2397 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2398 static jclass LDKEvent_PaymentForwarded_class = NULL;
2399 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2400 static jclass LDKEvent_ChannelClosed_class = NULL;
2401 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2402 static jclass LDKEvent_DiscardFunding_class = NULL;
2403 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2404 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2405 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2406 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
2407 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
2408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2409 LDKEvent_FundingGenerationReady_class =
2410 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2411 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2412 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[BJ)V");
2413 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2414 LDKEvent_PaymentReceived_class =
2415 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2416 CHECK(LDKEvent_PaymentReceived_class != NULL);
2417 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2418 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2419 LDKEvent_PaymentClaimed_class =
2420 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
2421 CHECK(LDKEvent_PaymentClaimed_class != NULL);
2422 LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([BJJ)V");
2423 CHECK(LDKEvent_PaymentClaimed_meth != NULL);
2424 LDKEvent_PaymentSent_class =
2425 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2426 CHECK(LDKEvent_PaymentSent_class != NULL);
2427 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2428 CHECK(LDKEvent_PaymentSent_meth != NULL);
2429 LDKEvent_PaymentFailed_class =
2430 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2431 CHECK(LDKEvent_PaymentFailed_class != NULL);
2432 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2433 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2434 LDKEvent_PaymentPathSuccessful_class =
2435 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2436 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2437 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2438 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2439 LDKEvent_PaymentPathFailed_class =
2440 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2441 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2442 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2443 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2444 LDKEvent_ProbeSuccessful_class =
2445 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
2446 CHECK(LDKEvent_ProbeSuccessful_class != NULL);
2447 LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[B[J)V");
2448 CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
2449 LDKEvent_ProbeFailed_class =
2450 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
2451 CHECK(LDKEvent_ProbeFailed_class != NULL);
2452 LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[B[JJ)V");
2453 CHECK(LDKEvent_ProbeFailed_meth != NULL);
2454 LDKEvent_PendingHTLCsForwardable_class =
2455 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2456 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2457 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2458 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2459 LDKEvent_SpendableOutputs_class =
2460 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2461 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2462 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2463 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2464 LDKEvent_PaymentForwarded_class =
2465 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2466 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2467 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
2468 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2469 LDKEvent_ChannelClosed_class =
2470 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2471 CHECK(LDKEvent_ChannelClosed_class != NULL);
2472 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2473 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2474 LDKEvent_DiscardFunding_class =
2475 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2476 CHECK(LDKEvent_DiscardFunding_class != NULL);
2477 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2478 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2479 LDKEvent_OpenChannelRequest_class =
2480 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2481 CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2482 LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2483 CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2484 LDKEvent_HTLCHandlingFailed_class =
2485 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
2486 CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
2487 LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
2488 CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
2490 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2491 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2493 case LDKEvent_FundingGenerationReady: {
2494 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2495 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2496 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2497 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
2498 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2499 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2500 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2501 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2502 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
2503 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_conv);
2505 case LDKEvent_PaymentReceived: {
2506 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2507 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2508 int64_t amount_msat_conv = obj->payment_received.amount_msat;
2509 int64_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2510 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2512 case LDKEvent_PaymentClaimed: {
2513 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2514 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
2515 int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2516 int64_t purpose_ref = ((uintptr_t)&obj->payment_claimed.purpose) | 1;
2517 return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2519 case LDKEvent_PaymentSent: {
2520 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2521 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2522 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2523 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2524 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2525 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2526 int64_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2527 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2529 case LDKEvent_PaymentFailed: {
2530 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2531 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2532 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2533 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2534 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2536 case LDKEvent_PaymentPathSuccessful: {
2537 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2538 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2539 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2540 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2541 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2542 int64_tArray path_arr = NULL;
2543 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2544 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2545 for (size_t k = 0; k < path_var.datalen; k++) {
2546 LDKRouteHop path_conv_10_var = path_var.data[k];
2547 int64_t path_conv_10_ref = 0;
2548 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2549 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2550 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2551 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2552 path_arr_ptr[k] = path_conv_10_ref;
2554 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2555 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2557 case LDKEvent_PaymentPathFailed: {
2558 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2559 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2560 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2561 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2562 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
2563 int64_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2564 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
2565 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2566 int64_tArray path_arr = NULL;
2567 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2568 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2569 for (size_t k = 0; k < path_var.datalen; k++) {
2570 LDKRouteHop path_conv_10_var = path_var.data[k];
2571 int64_t path_conv_10_ref = 0;
2572 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2573 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2574 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2575 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2576 path_arr_ptr[k] = path_conv_10_ref;
2578 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2579 int64_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2580 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2581 int64_t retry_ref = 0;
2582 if ((uintptr_t)retry_var.inner > 4096) {
2583 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2584 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2585 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2586 retry_ref = (uintptr_t)retry_var.inner & ~1;
2588 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, rejected_by_dest_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref);
2590 case LDKEvent_ProbeSuccessful: {
2591 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2592 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
2593 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2594 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
2595 LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
2596 int64_tArray path_arr = NULL;
2597 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2598 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2599 for (size_t k = 0; k < path_var.datalen; k++) {
2600 LDKRouteHop path_conv_10_var = path_var.data[k];
2601 int64_t path_conv_10_ref = 0;
2602 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2603 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2604 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2605 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2606 path_arr_ptr[k] = path_conv_10_ref;
2608 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2609 return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2611 case LDKEvent_ProbeFailed: {
2612 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2613 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
2614 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2615 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
2616 LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
2617 int64_tArray path_arr = NULL;
2618 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2619 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2620 for (size_t k = 0; k < path_var.datalen; k++) {
2621 LDKRouteHop path_conv_10_var = path_var.data[k];
2622 int64_t path_conv_10_ref = 0;
2623 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2624 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2625 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2626 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2627 path_arr_ptr[k] = path_conv_10_ref;
2629 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2630 int64_t short_channel_id_ref = ((uintptr_t)&obj->probe_failed.short_channel_id) | 1;
2631 return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref);
2633 case LDKEvent_PendingHTLCsForwardable: {
2634 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2635 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
2637 case LDKEvent_SpendableOutputs: {
2638 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2639 int64_tArray outputs_arr = NULL;
2640 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2641 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2642 for (size_t b = 0; b < outputs_var.datalen; b++) {
2643 int64_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2644 outputs_arr_ptr[b] = outputs_conv_27_ref;
2646 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2647 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2649 case LDKEvent_PaymentForwarded: {
2650 int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2651 (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
2652 int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
2653 (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
2654 int64_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2655 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2656 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_arr, next_channel_id_arr, fee_earned_msat_ref, claim_from_onchain_tx_conv);
2658 case LDKEvent_ChannelClosed: {
2659 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2660 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2661 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
2662 int64_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2663 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
2665 case LDKEvent_DiscardFunding: {
2666 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2667 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2668 LDKTransaction transaction_var = obj->discard_funding.transaction;
2669 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2670 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2671 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2673 case LDKEvent_OpenChannelRequest: {
2674 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2675 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2676 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2677 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2678 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2679 int64_t push_msat_conv = obj->open_channel_request.push_msat;
2680 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2681 int64_t channel_type_ref = 0;
2682 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2683 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2684 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2685 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
2686 return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
2688 case LDKEvent_HTLCHandlingFailed: {
2689 int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2690 (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
2691 int64_t failed_next_destination_ref = ((uintptr_t)&obj->htlc_handling_failed.failed_next_destination) | 1;
2692 return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
2697 static jclass LDKCOption_EventZ_Some_class = NULL;
2698 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2699 static jclass LDKCOption_EventZ_None_class = NULL;
2700 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2702 LDKCOption_EventZ_Some_class =
2703 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2704 CHECK(LDKCOption_EventZ_Some_class != NULL);
2705 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2706 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2707 LDKCOption_EventZ_None_class =
2708 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2709 CHECK(LDKCOption_EventZ_None_class != NULL);
2710 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2711 CHECK(LDKCOption_EventZ_None_meth != NULL);
2713 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2714 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2716 case LDKCOption_EventZ_Some: {
2717 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2718 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2720 case LDKCOption_EventZ_None: {
2721 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2726 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2727 CHECK(owner->result_ok);
2728 return COption_EventZ_clone(&*owner->contents.result);
2730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2731 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2732 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2733 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2734 int64_t ret_ref = (uintptr_t)ret_copy;
2738 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2739 CHECK(!owner->result_ok);
2740 return DecodeError_clone(&*owner->contents.err);
2742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2743 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2744 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2745 int64_t ret_ref = 0;
2746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2749 ret_ref = (uintptr_t)ret_var.inner;
2750 if (ret_var.is_owned) {
2756 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2757 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2758 static jclass LDKErrorAction_IgnoreError_class = NULL;
2759 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2760 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2761 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2762 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2763 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2764 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2765 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2766 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2767 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2769 LDKErrorAction_DisconnectPeer_class =
2770 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2771 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2772 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2773 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2774 LDKErrorAction_IgnoreError_class =
2775 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2776 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2777 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2778 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2779 LDKErrorAction_IgnoreAndLog_class =
2780 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2781 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2782 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2783 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2784 LDKErrorAction_IgnoreDuplicateGossip_class =
2785 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2786 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2787 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2788 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2789 LDKErrorAction_SendErrorMessage_class =
2790 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2791 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2792 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2793 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2794 LDKErrorAction_SendWarningMessage_class =
2795 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2796 CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2797 LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2798 CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2800 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2801 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2803 case LDKErrorAction_DisconnectPeer: {
2804 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2805 int64_t msg_ref = 0;
2806 if ((uintptr_t)msg_var.inner > 4096) {
2807 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2808 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2809 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2810 msg_ref = (uintptr_t)msg_var.inner & ~1;
2812 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2814 case LDKErrorAction_IgnoreError: {
2815 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2817 case LDKErrorAction_IgnoreAndLog: {
2818 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2819 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2821 case LDKErrorAction_IgnoreDuplicateGossip: {
2822 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2824 case LDKErrorAction_SendErrorMessage: {
2825 LDKErrorMessage msg_var = obj->send_error_message.msg;
2826 int64_t msg_ref = 0;
2827 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2828 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2829 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2830 msg_ref = (uintptr_t)msg_var.inner & ~1;
2831 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2833 case LDKErrorAction_SendWarningMessage: {
2834 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2835 int64_t msg_ref = 0;
2836 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2837 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2838 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2839 msg_ref = (uintptr_t)msg_var.inner & ~1;
2840 jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2841 return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2846 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2847 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2848 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2849 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2850 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2851 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2852 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2853 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2854 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
2855 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
2856 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2857 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2858 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2859 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2860 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2861 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2862 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2863 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2864 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2865 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2866 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2867 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2868 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2869 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2870 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2871 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2872 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2873 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2874 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2875 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2876 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2877 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2878 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2879 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2880 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2881 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2882 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2883 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2884 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2885 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2887 LDKMessageSendEvent_SendAcceptChannel_class =
2888 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2889 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2890 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2891 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2892 LDKMessageSendEvent_SendOpenChannel_class =
2893 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2894 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2895 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2896 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2897 LDKMessageSendEvent_SendFundingCreated_class =
2898 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2899 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2900 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2901 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2902 LDKMessageSendEvent_SendFundingSigned_class =
2903 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2904 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2905 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2906 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2907 LDKMessageSendEvent_SendChannelReady_class =
2908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
2909 CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
2910 LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
2911 CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
2912 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2914 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2915 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2916 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2917 LDKMessageSendEvent_UpdateHTLCs_class =
2918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2919 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2920 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2921 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2922 LDKMessageSendEvent_SendRevokeAndACK_class =
2923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2924 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2925 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2926 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2927 LDKMessageSendEvent_SendClosingSigned_class =
2928 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2929 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2930 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2931 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2932 LDKMessageSendEvent_SendShutdown_class =
2933 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2934 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2935 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2936 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2937 LDKMessageSendEvent_SendChannelReestablish_class =
2938 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2939 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2940 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2941 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2942 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2943 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2944 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2945 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2946 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2947 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2948 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2949 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2950 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2951 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2952 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2953 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2954 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2955 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2956 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2957 LDKMessageSendEvent_SendChannelUpdate_class =
2958 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2959 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2960 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2961 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2962 LDKMessageSendEvent_HandleError_class =
2963 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2964 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2965 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2966 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2967 LDKMessageSendEvent_SendChannelRangeQuery_class =
2968 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2969 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2970 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2971 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2972 LDKMessageSendEvent_SendShortIdsQuery_class =
2973 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2974 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2975 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2976 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2977 LDKMessageSendEvent_SendReplyChannelRange_class =
2978 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2979 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2980 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2981 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2982 LDKMessageSendEvent_SendGossipTimestampFilter_class =
2983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2984 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2985 LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2986 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2988 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2989 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2991 case LDKMessageSendEvent_SendAcceptChannel: {
2992 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2993 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2994 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2995 int64_t msg_ref = 0;
2996 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2997 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2998 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2999 msg_ref = (uintptr_t)msg_var.inner & ~1;
3000 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
3002 case LDKMessageSendEvent_SendOpenChannel: {
3003 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3004 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
3005 LDKOpenChannel msg_var = obj->send_open_channel.msg;
3006 int64_t msg_ref = 0;
3007 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3008 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3009 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3010 msg_ref = (uintptr_t)msg_var.inner & ~1;
3011 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
3013 case LDKMessageSendEvent_SendFundingCreated: {
3014 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3015 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
3016 LDKFundingCreated msg_var = obj->send_funding_created.msg;
3017 int64_t msg_ref = 0;
3018 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3019 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3020 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3021 msg_ref = (uintptr_t)msg_var.inner & ~1;
3022 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
3024 case LDKMessageSendEvent_SendFundingSigned: {
3025 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3026 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
3027 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3028 int64_t msg_ref = 0;
3029 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3030 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3031 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3032 msg_ref = (uintptr_t)msg_var.inner & ~1;
3033 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
3035 case LDKMessageSendEvent_SendChannelReady: {
3036 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3037 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
3038 LDKChannelReady msg_var = obj->send_channel_ready.msg;
3039 int64_t msg_ref = 0;
3040 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3041 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3042 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3043 msg_ref = (uintptr_t)msg_var.inner & ~1;
3044 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
3046 case LDKMessageSendEvent_SendAnnouncementSignatures: {
3047 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3048 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
3049 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3050 int64_t msg_ref = 0;
3051 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3052 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3053 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3054 msg_ref = (uintptr_t)msg_var.inner & ~1;
3055 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
3057 case LDKMessageSendEvent_UpdateHTLCs: {
3058 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3059 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
3060 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3061 int64_t updates_ref = 0;
3062 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3063 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3064 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3065 updates_ref = (uintptr_t)updates_var.inner & ~1;
3066 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
3068 case LDKMessageSendEvent_SendRevokeAndACK: {
3069 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3070 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
3071 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3072 int64_t msg_ref = 0;
3073 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3074 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3075 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3076 msg_ref = (uintptr_t)msg_var.inner & ~1;
3077 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
3079 case LDKMessageSendEvent_SendClosingSigned: {
3080 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3081 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
3082 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3083 int64_t msg_ref = 0;
3084 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3085 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3086 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3087 msg_ref = (uintptr_t)msg_var.inner & ~1;
3088 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
3090 case LDKMessageSendEvent_SendShutdown: {
3091 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3092 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
3093 LDKShutdown msg_var = obj->send_shutdown.msg;
3094 int64_t msg_ref = 0;
3095 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3096 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3097 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3098 msg_ref = (uintptr_t)msg_var.inner & ~1;
3099 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
3101 case LDKMessageSendEvent_SendChannelReestablish: {
3102 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3103 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
3104 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3105 int64_t msg_ref = 0;
3106 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3107 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3108 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3109 msg_ref = (uintptr_t)msg_var.inner & ~1;
3110 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
3112 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
3113 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.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 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3120 int64_t update_msg_ref = 0;
3121 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3122 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3123 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3124 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
3125 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
3127 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
3128 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3129 int64_t msg_ref = 0;
3130 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3131 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3132 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3133 msg_ref = (uintptr_t)msg_var.inner & ~1;
3134 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
3136 case LDKMessageSendEvent_BroadcastChannelUpdate: {
3137 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3138 int64_t msg_ref = 0;
3139 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3140 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3141 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3142 msg_ref = (uintptr_t)msg_var.inner & ~1;
3143 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
3145 case LDKMessageSendEvent_SendChannelUpdate: {
3146 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3147 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
3148 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3149 int64_t msg_ref = 0;
3150 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3151 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3152 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3153 msg_ref = (uintptr_t)msg_var.inner & ~1;
3154 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
3156 case LDKMessageSendEvent_HandleError: {
3157 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3158 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
3159 int64_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
3160 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
3162 case LDKMessageSendEvent_SendChannelRangeQuery: {
3163 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3164 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
3165 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3166 int64_t msg_ref = 0;
3167 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3168 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3169 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3170 msg_ref = (uintptr_t)msg_var.inner & ~1;
3171 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3173 case LDKMessageSendEvent_SendShortIdsQuery: {
3174 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3175 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3176 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3177 int64_t msg_ref = 0;
3178 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3179 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3180 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3181 msg_ref = (uintptr_t)msg_var.inner & ~1;
3182 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3184 case LDKMessageSendEvent_SendReplyChannelRange: {
3185 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3186 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3187 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3188 int64_t msg_ref = 0;
3189 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3190 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3191 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3192 msg_ref = (uintptr_t)msg_var.inner & ~1;
3193 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3195 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3196 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3197 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3198 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3199 int64_t msg_ref = 0;
3200 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3201 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3202 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3203 msg_ref = (uintptr_t)msg_var.inner & ~1;
3204 return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3209 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3210 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3211 for (size_t i = 0; i < ret.datalen; i++) {
3212 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3216 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3217 CHECK(owner->result_ok);
3218 return TxOut_clone(&*owner->contents.result);
3220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3221 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3222 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3223 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3224 return (int64_t)ret_ref;
3227 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3228 CHECK(!owner->result_ok);
3229 return AccessError_clone(&*owner->contents.err);
3231 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3232 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3233 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
3237 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3241 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
3242 int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3246 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3250 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
3251 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3252 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3253 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3257 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3258 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3259 for (size_t i = 0; i < ret.datalen; i++) {
3260 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3264 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
3265 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
3266 for (size_t i = 0; i < ret.datalen; i++) {
3267 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3271 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3272 CHECK(owner->result_ok);
3273 return *owner->contents.result;
3275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3276 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3277 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3280 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3281 CHECK(!owner->result_ok);
3282 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3284 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3285 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3286 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3290 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
3291 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
3292 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
3293 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
3294 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
3295 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
3296 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
3297 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
3298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
3299 LDKMonitorEvent_HTLCEvent_class =
3300 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
3301 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
3302 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
3303 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
3304 LDKMonitorEvent_CommitmentTxConfirmed_class =
3305 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
3306 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
3307 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
3308 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
3309 LDKMonitorEvent_UpdateCompleted_class =
3310 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
3311 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
3312 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
3313 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
3314 LDKMonitorEvent_UpdateFailed_class =
3315 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
3316 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
3317 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
3318 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
3320 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3321 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
3323 case LDKMonitorEvent_HTLCEvent: {
3324 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3325 int64_t htlc_event_ref = 0;
3326 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3327 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3328 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3329 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
3330 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
3332 case LDKMonitorEvent_CommitmentTxConfirmed: {
3333 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3334 int64_t commitment_tx_confirmed_ref = 0;
3335 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3336 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3337 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3338 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
3339 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
3341 case LDKMonitorEvent_UpdateCompleted: {
3342 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
3343 int64_t funding_txo_ref = 0;
3344 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3345 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3346 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3347 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
3348 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
3349 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
3351 case LDKMonitorEvent_UpdateFailed: {
3352 LDKOutPoint update_failed_var = obj->update_failed;
3353 int64_t update_failed_ref = 0;
3354 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3355 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3356 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3357 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
3358 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
3363 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3364 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3365 for (size_t i = 0; i < ret.datalen; i++) {
3366 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3370 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3371 return OutPoint_clone(&owner->a);
3373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3374 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
3375 LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3376 int64_t ret_ref = 0;
3377 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3378 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3379 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3380 ret_ref = (uintptr_t)ret_var.inner;
3381 if (ret_var.is_owned) {
3387 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3388 return CVec_MonitorEventZ_clone(&owner->b);
3390 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3391 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
3392 LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3393 int64_tArray ret_arr = NULL;
3394 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3395 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3396 for (size_t o = 0; o < ret_var.datalen; o++) {
3397 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3398 *ret_conv_14_copy = ret_var.data[o];
3399 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
3400 ret_arr_ptr[o] = ret_conv_14_ref;
3402 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3407 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3411 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
3412 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3413 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
3417 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3418 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3419 for (size_t i = 0; i < ret.datalen; i++) {
3420 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3424 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
3425 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
3426 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
3427 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
3428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
3429 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
3430 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
3431 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
3432 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
3433 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
3434 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
3435 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
3436 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
3437 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
3438 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
3440 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3441 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3443 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3444 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3445 *some_conv = obj->some;
3446 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3447 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((int64_t)some_conv));
3449 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3450 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
3455 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3456 CHECK(owner->result_ok);
3457 return FixedPenaltyScorer_clone(&*owner->contents.result);
3459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3460 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3461 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3462 int64_t ret_ref = 0;
3463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3466 ret_ref = (uintptr_t)ret_var.inner;
3467 if (ret_var.is_owned) {
3473 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3474 CHECK(!owner->result_ok);
3475 return DecodeError_clone(&*owner->contents.err);
3477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3478 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3479 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3480 int64_t ret_ref = 0;
3481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3484 ret_ref = (uintptr_t)ret_var.inner;
3485 if (ret_var.is_owned) {
3491 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3495 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
3496 int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3500 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3504 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
3505 int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3509 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
3510 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
3511 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
3512 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
3513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
3514 LDKCOption_C2Tuple_u64u64ZZ_Some_class =
3515 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
3516 CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
3517 LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
3518 CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
3519 LDKCOption_C2Tuple_u64u64ZZ_None_class =
3520 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
3521 CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
3522 LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
3523 CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
3525 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3526 LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)(ptr & ~1);
3528 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
3529 LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3530 *some_conv = obj->some;
3531 *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3532 return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, ((int64_t)some_conv));
3534 case LDKCOption_C2Tuple_u64u64ZZ_None: {
3535 return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
3540 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3541 LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3542 for (size_t i = 0; i < ret.datalen; i++) {
3543 ret.data[i] = NodeId_clone(&orig->data[i]);
3547 typedef struct LDKLogger_JCalls {
3548 atomic_size_t refcnt;
3553 static void LDKLogger_JCalls_free(void* this_arg) {
3554 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3555 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3557 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3558 if (get_jenv_res == JNI_EDETACHED) {
3559 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3561 DO_ASSERT(get_jenv_res == JNI_OK);
3563 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3564 if (get_jenv_res == JNI_EDETACHED) {
3565 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3570 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3571 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3574 if (get_jenv_res == JNI_EDETACHED) {
3575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3577 DO_ASSERT(get_jenv_res == JNI_OK);
3579 LDKRecord record_var = *record;
3580 int64_t record_ref = 0;
3581 record_var = Record_clone(&record_var);
3582 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3583 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3584 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3585 record_ref = (uintptr_t)record_var.inner;
3586 if (record_var.is_owned) {
3589 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3591 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
3592 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3593 (*env)->ExceptionDescribe(env);
3594 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
3596 if (get_jenv_res == JNI_EDETACHED) {
3597 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3600 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3601 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3602 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3604 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3605 jclass c = (*env)->GetObjectClass(env, o);
3607 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3608 atomic_init(&calls->refcnt, 1);
3609 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3610 calls->o = (*env)->NewWeakGlobalRef(env, o);
3611 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
3612 CHECK(calls->log_meth != NULL);
3615 .this_arg = (void*) calls,
3616 .log = log_LDKLogger_jcall,
3617 .free = LDKLogger_JCalls_free,
3621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3622 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3623 *res_ptr = LDKLogger_init(env, clz, o);
3624 return (uint64_t)res_ptr;
3626 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3627 CHECK(owner->result_ok);
3628 return &*owner->contents.result;
3630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3631 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3632 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3633 int64_t ret_ref = 0;
3634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3637 ret_ref = (uintptr_t)ret_var.inner & ~1;
3641 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3642 CHECK(!owner->result_ok);
3643 return DecodeError_clone(&*owner->contents.err);
3645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3646 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3647 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3648 int64_t ret_ref = 0;
3649 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3650 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3652 ret_ref = (uintptr_t)ret_var.inner;
3653 if (ret_var.is_owned) {
3659 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3660 CHECK(owner->result_ok);
3661 return InitFeatures_clone(&*owner->contents.result);
3663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3664 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3665 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3666 int64_t ret_ref = 0;
3667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3670 ret_ref = (uintptr_t)ret_var.inner;
3671 if (ret_var.is_owned) {
3677 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3678 CHECK(!owner->result_ok);
3679 return DecodeError_clone(&*owner->contents.err);
3681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3682 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3683 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3684 int64_t ret_ref = 0;
3685 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3686 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3688 ret_ref = (uintptr_t)ret_var.inner;
3689 if (ret_var.is_owned) {
3695 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3696 CHECK(owner->result_ok);
3697 return ChannelFeatures_clone(&*owner->contents.result);
3699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3700 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3701 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3702 int64_t ret_ref = 0;
3703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3706 ret_ref = (uintptr_t)ret_var.inner;
3707 if (ret_var.is_owned) {
3713 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3714 CHECK(!owner->result_ok);
3715 return DecodeError_clone(&*owner->contents.err);
3717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3718 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3719 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3720 int64_t ret_ref = 0;
3721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3724 ret_ref = (uintptr_t)ret_var.inner;
3725 if (ret_var.is_owned) {
3731 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3732 CHECK(owner->result_ok);
3733 return NodeFeatures_clone(&*owner->contents.result);
3735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3736 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3737 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3738 int64_t ret_ref = 0;
3739 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3740 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3742 ret_ref = (uintptr_t)ret_var.inner;
3743 if (ret_var.is_owned) {
3749 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3750 CHECK(!owner->result_ok);
3751 return DecodeError_clone(&*owner->contents.err);
3753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3754 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3755 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3756 int64_t ret_ref = 0;
3757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3760 ret_ref = (uintptr_t)ret_var.inner;
3761 if (ret_var.is_owned) {
3767 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3768 CHECK(owner->result_ok);
3769 return InvoiceFeatures_clone(&*owner->contents.result);
3771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3772 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3773 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3774 int64_t ret_ref = 0;
3775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3778 ret_ref = (uintptr_t)ret_var.inner;
3779 if (ret_var.is_owned) {
3785 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3786 CHECK(!owner->result_ok);
3787 return DecodeError_clone(&*owner->contents.err);
3789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3790 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3791 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3792 int64_t ret_ref = 0;
3793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3796 ret_ref = (uintptr_t)ret_var.inner;
3797 if (ret_var.is_owned) {
3803 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3804 CHECK(owner->result_ok);
3805 return ChannelTypeFeatures_clone(&*owner->contents.result);
3807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3808 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3809 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3810 int64_t ret_ref = 0;
3811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3814 ret_ref = (uintptr_t)ret_var.inner;
3815 if (ret_var.is_owned) {
3821 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3822 CHECK(!owner->result_ok);
3823 return DecodeError_clone(&*owner->contents.err);
3825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3826 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3827 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3828 int64_t ret_ref = 0;
3829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3832 ret_ref = (uintptr_t)ret_var.inner;
3833 if (ret_var.is_owned) {
3839 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3840 CHECK(owner->result_ok);
3841 return NodeId_clone(&*owner->contents.result);
3843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3844 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3845 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3846 int64_t ret_ref = 0;
3847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3850 ret_ref = (uintptr_t)ret_var.inner;
3851 if (ret_var.is_owned) {
3857 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3858 CHECK(!owner->result_ok);
3859 return DecodeError_clone(&*owner->contents.err);
3861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3862 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3863 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3864 int64_t ret_ref = 0;
3865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3868 ret_ref = (uintptr_t)ret_var.inner;
3869 if (ret_var.is_owned) {
3875 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3876 CHECK(owner->result_ok);
3877 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3880 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3881 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3882 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3883 int64_t ret_ref = (uintptr_t)ret_copy;
3887 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3888 CHECK(!owner->result_ok);
3889 return DecodeError_clone(&*owner->contents.err);
3891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3892 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3893 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3894 int64_t ret_ref = 0;
3895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3898 ret_ref = (uintptr_t)ret_var.inner;
3899 if (ret_var.is_owned) {
3905 typedef struct LDKAccess_JCalls {
3906 atomic_size_t refcnt;
3909 jmethodID get_utxo_meth;
3911 static void LDKAccess_JCalls_free(void* this_arg) {
3912 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3913 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3915 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3916 if (get_jenv_res == JNI_EDETACHED) {
3917 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3919 DO_ASSERT(get_jenv_res == JNI_OK);
3921 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3922 if (get_jenv_res == JNI_EDETACHED) {
3923 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3928 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3929 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3931 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3932 if (get_jenv_res == JNI_EDETACHED) {
3933 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3935 DO_ASSERT(get_jenv_res == JNI_OK);
3937 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3938 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3939 int64_t short_channel_id_conv = short_channel_id;
3940 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3942 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
3943 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3944 (*env)->ExceptionDescribe(env);
3945 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
3947 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3948 CHECK_ACCESS(ret_ptr);
3949 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3951 if (get_jenv_res == JNI_EDETACHED) {
3952 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3956 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3957 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3958 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3960 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3961 jclass c = (*env)->GetObjectClass(env, o);
3963 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3964 atomic_init(&calls->refcnt, 1);
3965 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3966 calls->o = (*env)->NewWeakGlobalRef(env, o);
3967 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3968 CHECK(calls->get_utxo_meth != NULL);
3971 .this_arg = (void*) calls,
3972 .get_utxo = get_utxo_LDKAccess_jcall,
3973 .free = LDKAccess_JCalls_free,
3977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3978 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3979 *res_ptr = LDKAccess_init(env, clz, o);
3980 return (uint64_t)res_ptr;
3982 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) {
3983 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3984 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3985 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3986 unsigned char genesis_hash_arr[32];
3987 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3988 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3989 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3990 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3991 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3992 return (int64_t)ret_conv;
3995 static jclass LDKCOption_AccessZ_Some_class = NULL;
3996 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
3997 static jclass LDKCOption_AccessZ_None_class = NULL;
3998 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
3999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
4000 LDKCOption_AccessZ_Some_class =
4001 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
4002 CHECK(LDKCOption_AccessZ_Some_class != NULL);
4003 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
4004 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
4005 LDKCOption_AccessZ_None_class =
4006 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
4007 CHECK(LDKCOption_AccessZ_None_class != NULL);
4008 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
4009 CHECK(LDKCOption_AccessZ_None_meth != NULL);
4011 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4012 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
4014 case LDKCOption_AccessZ_Some: {
4015 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
4016 *some_ret = obj->some;
4017 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4018 if ((*some_ret).free == LDKAccess_JCalls_free) {
4019 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4020 LDKAccess_JCalls_cloned(&(*some_ret));
4022 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (int64_t)some_ret);
4024 case LDKCOption_AccessZ_None: {
4025 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
4030 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4031 CHECK(owner->result_ok);
4032 return *owner->contents.result;
4034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4035 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
4036 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4040 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4041 CHECK(!owner->result_ok);
4042 return LightningError_clone(&*owner->contents.err);
4044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4045 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
4046 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4047 int64_t ret_ref = 0;
4048 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4049 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4051 ret_ref = (uintptr_t)ret_var.inner;
4052 if (ret_var.is_owned) {
4058 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4059 return ChannelAnnouncement_clone(&owner->a);
4061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4062 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
4063 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4064 int64_t ret_ref = 0;
4065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4068 ret_ref = (uintptr_t)ret_var.inner;
4069 if (ret_var.is_owned) {
4075 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4076 return ChannelUpdate_clone(&owner->b);
4078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4079 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
4080 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4081 int64_t ret_ref = 0;
4082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4085 ret_ref = (uintptr_t)ret_var.inner;
4086 if (ret_var.is_owned) {
4092 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4093 return ChannelUpdate_clone(&owner->c);
4095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
4096 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
4097 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4098 int64_t ret_ref = 0;
4099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4102 ret_ref = (uintptr_t)ret_var.inner;
4103 if (ret_var.is_owned) {
4109 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4110 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4111 for (size_t i = 0; i < ret.datalen; i++) {
4112 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4116 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4117 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4118 for (size_t i = 0; i < ret.datalen; i++) {
4119 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4123 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4124 CHECK(owner->result_ok);
4125 return *owner->contents.result;
4127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4128 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
4129 CResult_NoneLightningErrorZ_get_ok(owner_conv);
4132 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4133 CHECK(!owner->result_ok);
4134 return LightningError_clone(&*owner->contents.err);
4136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4137 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
4138 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4139 int64_t ret_ref = 0;
4140 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4141 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4143 ret_ref = (uintptr_t)ret_var.inner;
4144 if (ret_var.is_owned) {
4150 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4151 CHECK(owner->result_ok);
4152 return ChannelUpdateInfo_clone(&*owner->contents.result);
4154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4155 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
4156 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4157 int64_t ret_ref = 0;
4158 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4159 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4161 ret_ref = (uintptr_t)ret_var.inner;
4162 if (ret_var.is_owned) {
4168 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4169 CHECK(!owner->result_ok);
4170 return DecodeError_clone(&*owner->contents.err);
4172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4173 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
4174 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4175 int64_t ret_ref = 0;
4176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4179 ret_ref = (uintptr_t)ret_var.inner;
4180 if (ret_var.is_owned) {
4186 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4187 CHECK(owner->result_ok);
4188 return ChannelInfo_clone(&*owner->contents.result);
4190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4191 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
4192 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4193 int64_t ret_ref = 0;
4194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4197 ret_ref = (uintptr_t)ret_var.inner;
4198 if (ret_var.is_owned) {
4204 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4205 CHECK(!owner->result_ok);
4206 return DecodeError_clone(&*owner->contents.err);
4208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4209 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
4210 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4211 int64_t ret_ref = 0;
4212 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4213 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4215 ret_ref = (uintptr_t)ret_var.inner;
4216 if (ret_var.is_owned) {
4222 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4223 CHECK(owner->result_ok);
4224 return RoutingFees_clone(&*owner->contents.result);
4226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4227 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
4228 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4229 int64_t ret_ref = 0;
4230 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4231 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4232 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4233 ret_ref = (uintptr_t)ret_var.inner;
4234 if (ret_var.is_owned) {
4240 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4241 CHECK(!owner->result_ok);
4242 return DecodeError_clone(&*owner->contents.err);
4244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4245 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
4246 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4247 int64_t ret_ref = 0;
4248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4251 ret_ref = (uintptr_t)ret_var.inner;
4252 if (ret_var.is_owned) {
4258 static jclass LDKNetAddress_IPv4_class = NULL;
4259 static jmethodID LDKNetAddress_IPv4_meth = NULL;
4260 static jclass LDKNetAddress_IPv6_class = NULL;
4261 static jmethodID LDKNetAddress_IPv6_meth = NULL;
4262 static jclass LDKNetAddress_OnionV2_class = NULL;
4263 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
4264 static jclass LDKNetAddress_OnionV3_class = NULL;
4265 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
4266 static jclass LDKNetAddress_Hostname_class = NULL;
4267 static jmethodID LDKNetAddress_Hostname_meth = NULL;
4268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
4269 LDKNetAddress_IPv4_class =
4270 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
4271 CHECK(LDKNetAddress_IPv4_class != NULL);
4272 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
4273 CHECK(LDKNetAddress_IPv4_meth != NULL);
4274 LDKNetAddress_IPv6_class =
4275 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
4276 CHECK(LDKNetAddress_IPv6_class != NULL);
4277 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
4278 CHECK(LDKNetAddress_IPv6_meth != NULL);
4279 LDKNetAddress_OnionV2_class =
4280 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
4281 CHECK(LDKNetAddress_OnionV2_class != NULL);
4282 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
4283 CHECK(LDKNetAddress_OnionV2_meth != NULL);
4284 LDKNetAddress_OnionV3_class =
4285 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
4286 CHECK(LDKNetAddress_OnionV3_class != NULL);
4287 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
4288 CHECK(LDKNetAddress_OnionV3_meth != NULL);
4289 LDKNetAddress_Hostname_class =
4290 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
4291 CHECK(LDKNetAddress_Hostname_class != NULL);
4292 LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
4293 CHECK(LDKNetAddress_Hostname_meth != NULL);
4295 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4296 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4298 case LDKNetAddress_IPv4: {
4299 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4300 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4301 int16_t port_conv = obj->i_pv4.port;
4302 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
4304 case LDKNetAddress_IPv6: {
4305 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4306 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4307 int16_t port_conv = obj->i_pv6.port;
4308 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
4310 case LDKNetAddress_OnionV2: {
4311 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4312 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4313 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4315 case LDKNetAddress_OnionV3: {
4316 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4317 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4318 int16_t checksum_conv = obj->onion_v3.checksum;
4319 int8_t version_conv = obj->onion_v3.version;
4320 int16_t port_conv = obj->onion_v3.port;
4321 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
4323 case LDKNetAddress_Hostname: {
4324 LDKHostname hostname_var = obj->hostname.hostname;
4325 int64_t hostname_ref = 0;
4326 CHECK((((uintptr_t)hostname_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4327 CHECK((((uintptr_t)&hostname_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4328 CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4329 hostname_ref = (uintptr_t)hostname_var.inner & ~1;
4330 int16_t port_conv = obj->hostname.port;
4331 return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
4336 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4337 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4338 for (size_t i = 0; i < ret.datalen; i++) {
4339 ret.data[i] = NetAddress_clone(&orig->data[i]);
4343 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4344 CHECK(owner->result_ok);
4345 return NodeAnnouncementInfo_clone(&*owner->contents.result);
4347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4348 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4349 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4350 int64_t ret_ref = 0;
4351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4354 ret_ref = (uintptr_t)ret_var.inner;
4355 if (ret_var.is_owned) {
4361 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4362 CHECK(!owner->result_ok);
4363 return DecodeError_clone(&*owner->contents.err);
4365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4366 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
4367 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4368 int64_t ret_ref = 0;
4369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4372 ret_ref = (uintptr_t)ret_var.inner;
4373 if (ret_var.is_owned) {
4379 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4380 CHECK(owner->result_ok);
4381 return NodeAlias_clone(&*owner->contents.result);
4383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4384 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
4385 LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4386 int64_t ret_ref = 0;
4387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4390 ret_ref = (uintptr_t)ret_var.inner;
4391 if (ret_var.is_owned) {
4397 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4398 CHECK(!owner->result_ok);
4399 return DecodeError_clone(&*owner->contents.err);
4401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4402 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
4403 LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4404 int64_t ret_ref = 0;
4405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4408 ret_ref = (uintptr_t)ret_var.inner;
4409 if (ret_var.is_owned) {
4415 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4416 CHECK(owner->result_ok);
4417 return NodeInfo_clone(&*owner->contents.result);
4419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4420 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4421 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4422 int64_t ret_ref = 0;
4423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4426 ret_ref = (uintptr_t)ret_var.inner;
4427 if (ret_var.is_owned) {
4433 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4434 CHECK(!owner->result_ok);
4435 return DecodeError_clone(&*owner->contents.err);
4437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4438 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
4439 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4440 int64_t ret_ref = 0;
4441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4444 ret_ref = (uintptr_t)ret_var.inner;
4445 if (ret_var.is_owned) {
4451 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4452 CHECK(owner->result_ok);
4453 return &*owner->contents.result;
4455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4456 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4457 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4458 int64_t ret_ref = 0;
4459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4462 ret_ref = (uintptr_t)ret_var.inner & ~1;
4466 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4467 CHECK(!owner->result_ok);
4468 return DecodeError_clone(&*owner->contents.err);
4470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4471 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
4472 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4473 int64_t ret_ref = 0;
4474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4477 ret_ref = (uintptr_t)ret_var.inner;
4478 if (ret_var.is_owned) {
4484 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4485 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4486 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4487 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4489 LDKCOption_CVec_NetAddressZZ_Some_class =
4490 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4491 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4492 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4493 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4494 LDKCOption_CVec_NetAddressZZ_None_class =
4495 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4496 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4497 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4498 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4500 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4501 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
4503 case LDKCOption_CVec_NetAddressZZ_Some: {
4504 LDKCVec_NetAddressZ some_var = obj->some;
4505 int64_tArray some_arr = NULL;
4506 some_arr = (*env)->NewLongArray(env, some_var.datalen);
4507 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4508 for (size_t m = 0; m < some_var.datalen; m++) {
4509 int64_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
4510 some_arr_ptr[m] = some_conv_12_ref;
4512 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4513 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4515 case LDKCOption_CVec_NetAddressZZ_None: {
4516 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4521 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4522 CHECK(owner->result_ok);
4523 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
4525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4526 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4527 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4528 int64_t ret_ref = 0;
4529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4532 ret_ref = (uintptr_t)ret_var.inner;
4533 if (ret_var.is_owned) {
4539 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4540 CHECK(!owner->result_ok);
4541 return DecodeError_clone(&*owner->contents.err);
4543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4544 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4545 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4546 int64_t ret_ref = 0;
4547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4550 ret_ref = (uintptr_t)ret_var.inner;
4551 if (ret_var.is_owned) {
4557 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4558 CHECK(owner->result_ok);
4559 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
4561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4562 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4563 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4564 int64_t ret_ref = 0;
4565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4568 ret_ref = (uintptr_t)ret_var.inner;
4569 if (ret_var.is_owned) {
4575 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4576 CHECK(!owner->result_ok);
4577 return DecodeError_clone(&*owner->contents.err);
4579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4580 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
4581 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4582 int64_t ret_ref = 0;
4583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4586 ret_ref = (uintptr_t)ret_var.inner;
4587 if (ret_var.is_owned) {
4593 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4594 CHECK(owner->result_ok);
4595 return SpendableOutputDescriptor_clone(&*owner->contents.result);
4597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4598 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4599 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4600 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4601 int64_t ret_ref = (uintptr_t)ret_copy;
4605 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4606 CHECK(!owner->result_ok);
4607 return DecodeError_clone(&*owner->contents.err);
4609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4610 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
4611 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4612 int64_t ret_ref = 0;
4613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4616 ret_ref = (uintptr_t)ret_var.inner;
4617 if (ret_var.is_owned) {
4623 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4624 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4625 for (size_t i = 0; i < ret.datalen; i++) {
4626 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4630 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4634 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4635 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4640 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4643 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4644 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
4645 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4646 jobjectArray ret_arr = NULL;
4647 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4649 for (size_t i = 0; i < ret_var.datalen; i++) {
4650 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4651 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
4652 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4658 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4659 CHECK(owner->result_ok);
4660 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4663 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4664 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4665 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4666 return ((int64_t)ret_conv);
4669 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4670 CHECK(!owner->result_ok);
4671 return *owner->contents.err;
4673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4674 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
4675 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4678 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4679 CHECK(owner->result_ok);
4680 return *owner->contents.result;
4682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4683 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4684 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4685 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
4689 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4690 CHECK(!owner->result_ok);
4691 return *owner->contents.err;
4693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4694 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
4695 CResult_SignatureNoneZ_get_err(owner_conv);
4698 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4702 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4703 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4704 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
4708 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4712 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
4713 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4714 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
4718 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4719 CHECK(owner->result_ok);
4720 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
4722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4723 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4724 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
4725 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
4726 return ((int64_t)ret_conv);
4729 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4730 CHECK(!owner->result_ok);
4731 return *owner->contents.err;
4733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4734 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
4735 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
4738 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4739 CHECK(owner->result_ok);
4740 return *owner->contents.result;
4742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4743 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4744 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4745 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
4749 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4750 CHECK(!owner->result_ok);
4751 return *owner->contents.err;
4753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4754 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
4755 CResult_SecretKeyNoneZ_get_err(owner_conv);
4758 typedef struct LDKBaseSign_JCalls {
4759 atomic_size_t refcnt;
4762 jmethodID get_per_commitment_point_meth;
4763 jmethodID release_commitment_secret_meth;
4764 jmethodID validate_holder_commitment_meth;
4765 jmethodID channel_keys_id_meth;
4766 jmethodID sign_counterparty_commitment_meth;
4767 jmethodID validate_counterparty_revocation_meth;
4768 jmethodID sign_holder_commitment_and_htlcs_meth;
4769 jmethodID sign_justice_revoked_output_meth;
4770 jmethodID sign_justice_revoked_htlc_meth;
4771 jmethodID sign_counterparty_htlc_transaction_meth;
4772 jmethodID sign_closing_transaction_meth;
4773 jmethodID sign_channel_announcement_meth;
4774 jmethodID ready_channel_meth;
4775 } LDKBaseSign_JCalls;
4776 static void LDKBaseSign_JCalls_free(void* this_arg) {
4777 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4778 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4780 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4781 if (get_jenv_res == JNI_EDETACHED) {
4782 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4784 DO_ASSERT(get_jenv_res == JNI_OK);
4786 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4787 if (get_jenv_res == JNI_EDETACHED) {
4788 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4793 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4794 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4796 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4797 if (get_jenv_res == JNI_EDETACHED) {
4798 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4800 DO_ASSERT(get_jenv_res == JNI_OK);
4802 int64_t idx_conv = idx;
4803 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4805 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
4806 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4807 (*env)->ExceptionDescribe(env);
4808 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
4810 LDKPublicKey ret_ref;
4811 CHECK((*env)->GetArrayLength(env, ret) == 33);
4812 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
4813 if (get_jenv_res == JNI_EDETACHED) {
4814 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4818 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4819 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4821 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4822 if (get_jenv_res == JNI_EDETACHED) {
4823 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4825 DO_ASSERT(get_jenv_res == JNI_OK);
4827 int64_t idx_conv = idx;
4828 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4830 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
4831 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4832 (*env)->ExceptionDescribe(env);
4833 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
4835 LDKThirtyTwoBytes ret_ref;
4836 CHECK((*env)->GetArrayLength(env, ret) == 32);
4837 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4838 if (get_jenv_res == JNI_EDETACHED) {
4839 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4843 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4844 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4846 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4847 if (get_jenv_res == JNI_EDETACHED) {
4848 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4850 DO_ASSERT(get_jenv_res == JNI_OK);
4852 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4853 int64_t holder_tx_ref = 0;
4854 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4855 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4856 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4857 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4858 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
4859 if (holder_tx_var.is_owned) {
4862 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4863 jobjectArray preimages_arr = NULL;
4864 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4866 for (size_t i = 0; i < preimages_var.datalen; i++) {
4867 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4868 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4869 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4872 FREE(preimages_var.data);
4873 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4875 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
4876 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4877 (*env)->ExceptionDescribe(env);
4878 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
4880 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4881 CHECK_ACCESS(ret_ptr);
4882 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4884 if (get_jenv_res == JNI_EDETACHED) {
4885 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4889 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4890 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4892 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4893 if (get_jenv_res == JNI_EDETACHED) {
4894 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4896 DO_ASSERT(get_jenv_res == JNI_OK);
4898 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4900 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
4901 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4902 (*env)->ExceptionDescribe(env);
4903 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
4905 LDKThirtyTwoBytes ret_ref;
4906 CHECK((*env)->GetArrayLength(env, ret) == 32);
4907 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4908 if (get_jenv_res == JNI_EDETACHED) {
4909 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4913 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4914 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4916 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4917 if (get_jenv_res == JNI_EDETACHED) {
4918 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4920 DO_ASSERT(get_jenv_res == JNI_OK);
4922 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4923 int64_t commitment_tx_ref = 0;
4924 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4925 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4926 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4927 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4928 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4929 if (commitment_tx_var.is_owned) {
4930 commitment_tx_ref |= 1;
4932 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4933 jobjectArray preimages_arr = NULL;
4934 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4936 for (size_t i = 0; i < preimages_var.datalen; i++) {
4937 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4938 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4939 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4942 FREE(preimages_var.data);
4943 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4945 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
4946 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4947 (*env)->ExceptionDescribe(env);
4948 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
4950 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4951 CHECK_ACCESS(ret_ptr);
4952 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4954 if (get_jenv_res == JNI_EDETACHED) {
4955 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4959 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4960 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4962 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4963 if (get_jenv_res == JNI_EDETACHED) {
4964 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4966 DO_ASSERT(get_jenv_res == JNI_OK);
4968 int64_t idx_conv = idx;
4969 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
4970 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
4971 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4973 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
4974 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4975 (*env)->ExceptionDescribe(env);
4976 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
4978 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4979 CHECK_ACCESS(ret_ptr);
4980 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4982 if (get_jenv_res == JNI_EDETACHED) {
4983 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4987 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4988 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4990 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4991 if (get_jenv_res == JNI_EDETACHED) {
4992 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4994 DO_ASSERT(get_jenv_res == JNI_OK);
4996 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4997 int64_t commitment_tx_ref = 0;
4998 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4999 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5000 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5001 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
5002 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
5003 if (commitment_tx_var.is_owned) {
5004 commitment_tx_ref |= 1;
5006 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5008 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
5009 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5010 (*env)->ExceptionDescribe(env);
5011 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
5013 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5014 CHECK_ACCESS(ret_ptr);
5015 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
5017 if (get_jenv_res == JNI_EDETACHED) {
5018 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5022 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]) {
5023 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5025 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5026 if (get_jenv_res == JNI_EDETACHED) {
5027 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5029 DO_ASSERT(get_jenv_res == JNI_OK);
5031 LDKTransaction justice_tx_var = justice_tx;
5032 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
5033 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
5034 Transaction_free(justice_tx_var);
5035 int64_t input_conv = input;
5036 int64_t amount_conv = amount;
5037 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
5038 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
5039 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5041 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr);
5042 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5043 (*env)->ExceptionDescribe(env);
5044 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
5046 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5047 CHECK_ACCESS(ret_ptr);
5048 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5050 if (get_jenv_res == JNI_EDETACHED) {
5051 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5055 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) {
5056 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5058 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5059 if (get_jenv_res == JNI_EDETACHED) {
5060 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5062 DO_ASSERT(get_jenv_res == JNI_OK);
5064 LDKTransaction justice_tx_var = justice_tx;
5065 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
5066 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
5067 Transaction_free(justice_tx_var);
5068 int64_t input_conv = input;
5069 int64_t amount_conv = amount;
5070 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
5071 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
5072 LDKHTLCOutputInCommitment htlc_var = *htlc;
5073 int64_t htlc_ref = 0;
5074 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
5075 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5076 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5077 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
5078 htlc_ref = (uintptr_t)htlc_var.inner;
5079 if (htlc_var.is_owned) {
5082 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5084 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr, htlc_ref);
5085 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5086 (*env)->ExceptionDescribe(env);
5087 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
5089 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5090 CHECK_ACCESS(ret_ptr);
5091 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5093 if (get_jenv_res == JNI_EDETACHED) {
5094 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5098 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) {
5099 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5101 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5102 if (get_jenv_res == JNI_EDETACHED) {
5103 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5105 DO_ASSERT(get_jenv_res == JNI_OK);
5107 LDKTransaction htlc_tx_var = htlc_tx;
5108 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
5109 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
5110 Transaction_free(htlc_tx_var);
5111 int64_t input_conv = input;
5112 int64_t amount_conv = amount;
5113 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
5114 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
5115 LDKHTLCOutputInCommitment htlc_var = *htlc;
5116 int64_t htlc_ref = 0;
5117 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
5118 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5119 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5120 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
5121 htlc_ref = (uintptr_t)htlc_var.inner;
5122 if (htlc_var.is_owned) {
5125 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5127 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input_conv, amount_conv, per_commitment_point_arr, htlc_ref);
5128 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5129 (*env)->ExceptionDescribe(env);
5130 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
5132 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5133 CHECK_ACCESS(ret_ptr);
5134 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5136 if (get_jenv_res == JNI_EDETACHED) {
5137 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5141 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
5142 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5144 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5145 if (get_jenv_res == JNI_EDETACHED) {
5146 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5148 DO_ASSERT(get_jenv_res == JNI_OK);
5150 LDKClosingTransaction closing_tx_var = *closing_tx;
5151 int64_t closing_tx_ref = 0;
5152 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
5153 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5154 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5155 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
5156 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
5157 if (closing_tx_var.is_owned) {
5158 closing_tx_ref |= 1;
5160 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5162 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
5163 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5164 (*env)->ExceptionDescribe(env);
5165 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
5167 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5168 CHECK_ACCESS(ret_ptr);
5169 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5171 if (get_jenv_res == JNI_EDETACHED) {
5172 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5176 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
5177 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5179 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5180 if (get_jenv_res == JNI_EDETACHED) {
5181 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5183 DO_ASSERT(get_jenv_res == JNI_OK);
5185 LDKUnsignedChannelAnnouncement msg_var = *msg;
5186 int64_t msg_ref = 0;
5187 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
5188 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5189 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5190 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5191 msg_ref = (uintptr_t)msg_var.inner;
5192 if (msg_var.is_owned) {
5195 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5197 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
5198 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5199 (*env)->ExceptionDescribe(env);
5200 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
5202 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5203 CHECK_ACCESS(ret_ptr);
5204 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
5206 if (get_jenv_res == JNI_EDETACHED) {
5207 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5211 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
5212 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5214 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5215 if (get_jenv_res == JNI_EDETACHED) {
5216 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5218 DO_ASSERT(get_jenv_res == JNI_OK);
5220 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
5221 int64_t channel_parameters_ref = 0;
5222 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
5223 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5224 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5225 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
5226 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
5227 if (channel_parameters_var.is_owned) {
5228 channel_parameters_ref |= 1;
5230 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5232 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
5233 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5234 (*env)->ExceptionDescribe(env);
5235 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
5237 if (get_jenv_res == JNI_EDETACHED) {
5238 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5241 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5242 jclass c = (*env)->GetObjectClass(env, o);
5244 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
5245 atomic_init(&calls->refcnt, 1);
5246 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5247 calls->o = (*env)->NewWeakGlobalRef(env, o);
5248 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
5249 CHECK(calls->get_per_commitment_point_meth != NULL);
5250 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
5251 CHECK(calls->release_commitment_secret_meth != NULL);
5252 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
5253 CHECK(calls->validate_holder_commitment_meth != NULL);
5254 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
5255 CHECK(calls->channel_keys_id_meth != NULL);
5256 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
5257 CHECK(calls->sign_counterparty_commitment_meth != NULL);
5258 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
5259 CHECK(calls->validate_counterparty_revocation_meth != NULL);
5260 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
5261 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
5262 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
5263 CHECK(calls->sign_justice_revoked_output_meth != NULL);
5264 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
5265 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
5266 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
5267 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
5268 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
5269 CHECK(calls->sign_closing_transaction_meth != NULL);
5270 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
5271 CHECK(calls->sign_channel_announcement_meth != NULL);
5272 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
5273 CHECK(calls->ready_channel_meth != NULL);
5275 LDKChannelPublicKeys pubkeys_conv;
5276 pubkeys_conv.inner = (void*)(pubkeys & (~1));
5277 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
5278 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5281 .this_arg = (void*) calls,
5282 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
5283 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
5284 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
5285 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
5286 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
5287 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
5288 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
5289 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
5290 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
5291 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
5292 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
5293 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
5294 .ready_channel = ready_channel_LDKBaseSign_jcall,
5295 .free = LDKBaseSign_JCalls_free,
5296 .pubkeys = pubkeys_conv,
5297 .set_pubkeys = NULL,
5301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5302 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
5303 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
5304 return (uint64_t)res_ptr;
5306 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) {
5307 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5308 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5309 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5310 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5311 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
5315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
5316 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5317 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5318 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5319 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5320 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
5324 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) {
5325 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5326 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5327 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5328 LDKHolderCommitmentTransaction holder_tx_conv;
5329 holder_tx_conv.inner = (void*)(holder_tx & (~1));
5330 holder_tx_conv.is_owned = false;
5331 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
5332 LDKCVec_PaymentPreimageZ preimages_constr;
5333 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5334 if (preimages_constr.datalen > 0)
5335 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5337 preimages_constr.data = NULL;
5338 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5339 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5340 LDKThirtyTwoBytes preimages_conv_8_ref;
5341 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5342 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5343 preimages_constr.data[i] = preimages_conv_8_ref;
5345 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5346 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
5347 return (int64_t)ret_conv;
5350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5351 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5352 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5353 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5354 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5355 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
5359 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) {
5360 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5361 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5362 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5363 LDKCommitmentTransaction commitment_tx_conv;
5364 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5365 commitment_tx_conv.is_owned = false;
5366 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5367 LDKCVec_PaymentPreimageZ preimages_constr;
5368 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5369 if (preimages_constr.datalen > 0)
5370 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5372 preimages_constr.data = NULL;
5373 for (size_t i = 0; i < preimages_constr.datalen; i++) {
5374 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5375 LDKThirtyTwoBytes preimages_conv_8_ref;
5376 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5377 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5378 preimages_constr.data[i] = preimages_conv_8_ref;
5380 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5381 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
5382 return (int64_t)ret_conv;
5385 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) {
5386 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5387 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5388 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5389 unsigned char secret_arr[32];
5390 CHECK((*env)->GetArrayLength(env, secret) == 32);
5391 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
5392 unsigned char (*secret_ref)[32] = &secret_arr;
5393 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5394 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
5395 return (int64_t)ret_conv;
5398 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) {
5399 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5400 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5401 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5402 LDKHolderCommitmentTransaction commitment_tx_conv;
5403 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
5404 commitment_tx_conv.is_owned = false;
5405 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5406 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5407 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
5408 return (int64_t)ret_conv;
5411 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) {
5412 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5413 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5414 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5415 LDKTransaction justice_tx_ref;
5416 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5417 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5418 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5419 justice_tx_ref.data_is_owned = true;
5420 unsigned char per_commitment_key_arr[32];
5421 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5422 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5423 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5424 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5425 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
5426 return (int64_t)ret_conv;
5429 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) {
5430 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5431 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5432 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5433 LDKTransaction justice_tx_ref;
5434 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5435 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5436 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5437 justice_tx_ref.data_is_owned = true;
5438 unsigned char per_commitment_key_arr[32];
5439 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5440 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5441 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5442 LDKHTLCOutputInCommitment htlc_conv;
5443 htlc_conv.inner = (void*)(htlc & (~1));
5444 htlc_conv.is_owned = false;
5445 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5446 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5447 *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);
5448 return (int64_t)ret_conv;
5451 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) {
5452 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5453 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5454 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5455 LDKTransaction htlc_tx_ref;
5456 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
5457 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
5458 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
5459 htlc_tx_ref.data_is_owned = true;
5460 LDKPublicKey per_commitment_point_ref;
5461 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
5462 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
5463 LDKHTLCOutputInCommitment htlc_conv;
5464 htlc_conv.inner = (void*)(htlc & (~1));
5465 htlc_conv.is_owned = false;
5466 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5467 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5468 *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);
5469 return (int64_t)ret_conv;
5472 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) {
5473 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5474 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5475 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5476 LDKClosingTransaction closing_tx_conv;
5477 closing_tx_conv.inner = (void*)(closing_tx & (~1));
5478 closing_tx_conv.is_owned = false;
5479 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5480 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5481 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5482 return (int64_t)ret_conv;
5485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5486 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5487 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5488 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5489 LDKUnsignedChannelAnnouncement msg_conv;
5490 msg_conv.inner = (void*)(msg & (~1));
5491 msg_conv.is_owned = false;
5492 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5493 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5494 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5495 return (int64_t)ret_conv;
5498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5499 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5500 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5501 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5502 LDKChannelTransactionParameters channel_parameters_conv;
5503 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
5504 channel_parameters_conv.is_owned = false;
5505 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5506 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5509 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5510 if (this_arg->set_pubkeys != NULL)
5511 this_arg->set_pubkeys(this_arg);
5512 return this_arg->pubkeys;
5514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5515 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5516 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5517 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5518 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5519 int64_t ret_ref = 0;
5520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5523 ret_ref = (uintptr_t)ret_var.inner;
5524 if (ret_var.is_owned) {
5530 typedef struct LDKSign_JCalls {
5531 atomic_size_t refcnt;
5534 LDKBaseSign_JCalls* BaseSign;
5535 jmethodID write_meth;
5537 static void LDKSign_JCalls_free(void* this_arg) {
5538 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5539 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5541 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5542 if (get_jenv_res == JNI_EDETACHED) {
5543 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5545 DO_ASSERT(get_jenv_res == JNI_OK);
5547 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5548 if (get_jenv_res == JNI_EDETACHED) {
5549 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5554 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5555 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5557 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5558 if (get_jenv_res == JNI_EDETACHED) {
5559 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5561 DO_ASSERT(get_jenv_res == JNI_OK);
5563 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5565 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5566 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5567 (*env)->ExceptionDescribe(env);
5568 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5570 LDKCVec_u8Z ret_ref;
5571 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5572 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5573 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5574 if (get_jenv_res == JNI_EDETACHED) {
5575 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5579 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5580 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5581 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5582 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5584 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5585 jclass c = (*env)->GetObjectClass(env, o);
5587 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5588 atomic_init(&calls->refcnt, 1);
5589 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5590 calls->o = (*env)->NewWeakGlobalRef(env, o);
5591 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5592 CHECK(calls->write_meth != NULL);
5594 LDKChannelPublicKeys pubkeys_conv;
5595 pubkeys_conv.inner = (void*)(pubkeys & (~1));
5596 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
5597 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5600 .this_arg = (void*) calls,
5601 .write = write_LDKSign_jcall,
5602 .cloned = LDKSign_JCalls_cloned,
5603 .free = LDKSign_JCalls_free,
5604 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5606 calls->BaseSign = ret.BaseSign.this_arg;
5609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5610 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5611 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5612 return (uint64_t)res_ptr;
5614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5615 LDKSign *inp = (LDKSign *)(arg & ~1);
5616 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
5617 DO_ASSERT((res_ptr & 1) == 0);
5618 return (int64_t)(res_ptr | 1);
5620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5621 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5622 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5623 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5624 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5625 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5626 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5627 CVec_u8Z_free(ret_var);
5631 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5632 CHECK(owner->result_ok);
5633 return Sign_clone(&*owner->contents.result);
5635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5636 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5637 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5638 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5639 return (int64_t)ret_ret;
5642 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5643 CHECK(!owner->result_ok);
5644 return DecodeError_clone(&*owner->contents.err);
5646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5647 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5648 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5649 int64_t ret_ref = 0;
5650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5653 ret_ref = (uintptr_t)ret_var.inner;
5654 if (ret_var.is_owned) {
5660 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5661 CHECK(owner->result_ok);
5662 return *owner->contents.result;
5664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5665 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5666 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5667 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5671 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5672 CHECK(!owner->result_ok);
5673 return *owner->contents.err;
5675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5676 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5677 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5680 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5681 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5682 for (size_t i = 0; i < ret.datalen; i++) {
5683 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5687 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5688 CHECK(owner->result_ok);
5689 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5691 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5692 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5693 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5694 jobjectArray ret_arr = NULL;
5695 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5697 for (size_t i = 0; i < ret_var.datalen; i++) {
5698 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
5699 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
5700 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
5701 CVec_u8Z_free(ret_conv_8_var);
5702 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5709 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5710 CHECK(!owner->result_ok);
5711 return *owner->contents.err;
5713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5714 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5715 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5718 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5719 CHECK(owner->result_ok);
5720 return InMemorySigner_clone(&*owner->contents.result);
5722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5723 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5724 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5725 int64_t ret_ref = 0;
5726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5729 ret_ref = (uintptr_t)ret_var.inner;
5730 if (ret_var.is_owned) {
5736 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5737 CHECK(!owner->result_ok);
5738 return DecodeError_clone(&*owner->contents.err);
5740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5741 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5742 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5743 int64_t ret_ref = 0;
5744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5747 ret_ref = (uintptr_t)ret_var.inner;
5748 if (ret_var.is_owned) {
5754 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5755 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5756 for (size_t i = 0; i < ret.datalen; i++) {
5757 ret.data[i] = TxOut_clone(&orig->data[i]);
5761 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5762 CHECK(owner->result_ok);
5763 return *owner->contents.result;
5765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5766 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5767 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5768 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5769 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5773 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5774 CHECK(!owner->result_ok);
5775 return *owner->contents.err;
5777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5778 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5779 CResult_TransactionNoneZ_get_err(owner_conv);
5782 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5783 return ThirtyTwoBytes_clone(&owner->a);
5785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5786 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5787 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5788 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
5792 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5793 return ChannelMonitor_clone(&owner->b);
5795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5796 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5797 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5798 int64_t ret_ref = 0;
5799 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5800 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5802 ret_ref = (uintptr_t)ret_var.inner;
5803 if (ret_var.is_owned) {
5809 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
5810 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
5811 for (size_t i = 0; i < ret.datalen; i++) {
5812 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
5816 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5817 CHECK(owner->result_ok);
5818 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
5820 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5821 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5822 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
5823 int64_tArray ret_arr = NULL;
5824 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5825 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5826 for (size_t j = 0; j < ret_var.datalen; j++) {
5827 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5828 *ret_conv_35_conv = ret_var.data[j];
5829 ret_arr_ptr[j] = ((int64_t)ret_conv_35_conv);
5831 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5836 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5837 CHECK(!owner->result_ok);
5838 return *owner->contents.err;
5840 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5841 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
5842 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
5846 static jclass LDKCOption_u16Z_Some_class = NULL;
5847 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
5848 static jclass LDKCOption_u16Z_None_class = NULL;
5849 static jmethodID LDKCOption_u16Z_None_meth = NULL;
5850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
5851 LDKCOption_u16Z_Some_class =
5852 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
5853 CHECK(LDKCOption_u16Z_Some_class != NULL);
5854 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
5855 CHECK(LDKCOption_u16Z_Some_meth != NULL);
5856 LDKCOption_u16Z_None_class =
5857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
5858 CHECK(LDKCOption_u16Z_None_class != NULL);
5859 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
5860 CHECK(LDKCOption_u16Z_None_meth != NULL);
5862 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5863 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5865 case LDKCOption_u16Z_Some: {
5866 int16_t some_conv = obj->some;
5867 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
5869 case LDKCOption_u16Z_None: {
5870 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
5875 static jclass LDKAPIError_APIMisuseError_class = NULL;
5876 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
5877 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
5878 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
5879 static jclass LDKAPIError_RouteError_class = NULL;
5880 static jmethodID LDKAPIError_RouteError_meth = NULL;
5881 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
5882 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
5883 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
5884 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
5885 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
5886 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
5887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
5888 LDKAPIError_APIMisuseError_class =
5889 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
5890 CHECK(LDKAPIError_APIMisuseError_class != NULL);
5891 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
5892 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
5893 LDKAPIError_FeeRateTooHigh_class =
5894 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
5895 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
5896 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
5897 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
5898 LDKAPIError_RouteError_class =
5899 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
5900 CHECK(LDKAPIError_RouteError_class != NULL);
5901 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
5902 CHECK(LDKAPIError_RouteError_meth != NULL);
5903 LDKAPIError_ChannelUnavailable_class =
5904 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
5905 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
5906 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
5907 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
5908 LDKAPIError_MonitorUpdateFailed_class =
5909 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
5910 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
5911 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
5912 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
5913 LDKAPIError_IncompatibleShutdownScript_class =
5914 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
5915 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
5916 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
5917 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
5919 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5920 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5922 case LDKAPIError_APIMisuseError: {
5923 LDKStr err_str = obj->api_misuse_error.err;
5924 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5925 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
5927 case LDKAPIError_FeeRateTooHigh: {
5928 LDKStr err_str = obj->fee_rate_too_high.err;
5929 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5930 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
5931 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
5933 case LDKAPIError_RouteError: {
5934 LDKStr err_str = obj->route_error.err;
5935 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5936 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
5938 case LDKAPIError_ChannelUnavailable: {
5939 LDKStr err_str = obj->channel_unavailable.err;
5940 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5941 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
5943 case LDKAPIError_MonitorUpdateFailed: {
5944 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
5946 case LDKAPIError_IncompatibleShutdownScript: {
5947 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5948 int64_t script_ref = 0;
5949 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5950 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5951 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5952 script_ref = (uintptr_t)script_var.inner & ~1;
5953 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
5958 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5959 CHECK(owner->result_ok);
5960 return *owner->contents.result;
5962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5963 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5964 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5967 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5968 CHECK(!owner->result_ok);
5969 return APIError_clone(&*owner->contents.err);
5971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5972 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5973 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5974 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5975 int64_t ret_ref = (uintptr_t)ret_copy;
5979 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5980 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5981 for (size_t i = 0; i < ret.datalen; i++) {
5982 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5986 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5987 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5988 for (size_t i = 0; i < ret.datalen; i++) {
5989 ret.data[i] = APIError_clone(&orig->data[i]);
5993 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5994 CHECK(owner->result_ok);
5995 return ThirtyTwoBytes_clone(&*owner->contents.result);
5997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5998 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5999 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6000 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
6004 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6005 CHECK(!owner->result_ok);
6006 return APIError_clone(&*owner->contents.err);
6008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6009 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
6010 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6011 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
6012 int64_t ret_ref = (uintptr_t)ret_copy;
6016 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
6017 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
6018 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
6019 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
6020 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
6021 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
6022 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
6023 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
6024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
6025 LDKPaymentSendFailure_ParameterError_class =
6026 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
6027 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
6028 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
6029 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
6030 LDKPaymentSendFailure_PathParameterError_class =
6031 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
6032 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
6033 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
6034 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
6035 LDKPaymentSendFailure_AllFailedRetrySafe_class =
6036 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
6037 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
6038 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
6039 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
6040 LDKPaymentSendFailure_PartialFailure_class =
6041 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
6042 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
6043 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
6044 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
6046 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6047 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
6049 case LDKPaymentSendFailure_ParameterError: {
6050 int64_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
6051 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
6053 case LDKPaymentSendFailure_PathParameterError: {
6054 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6055 int64_tArray path_parameter_error_arr = NULL;
6056 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
6057 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
6058 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6059 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6060 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6061 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6062 path_parameter_error_arr_ptr[w] = (int64_t)path_parameter_error_conv_22_conv;
6064 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
6065 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
6067 case LDKPaymentSendFailure_AllFailedRetrySafe: {
6068 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
6069 int64_tArray all_failed_retry_safe_arr = NULL;
6070 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
6071 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
6072 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
6073 int64_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
6074 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
6076 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
6077 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
6079 case LDKPaymentSendFailure_PartialFailure: {
6080 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6081 int64_tArray results_arr = NULL;
6082 results_arr = (*env)->NewLongArray(env, results_var.datalen);
6083 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
6084 for (size_t w = 0; w < results_var.datalen; w++) {
6085 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6086 *results_conv_22_conv = results_var.data[w];
6087 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6088 results_arr_ptr[w] = (int64_t)results_conv_22_conv;
6090 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
6091 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6092 int64_t failed_paths_retry_ref = 0;
6093 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
6094 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6095 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6096 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6097 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
6099 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6100 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
6101 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
6106 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6107 CHECK(owner->result_ok);
6108 return ThirtyTwoBytes_clone(&*owner->contents.result);
6110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6111 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6112 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6113 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
6117 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6118 CHECK(!owner->result_ok);
6119 return PaymentSendFailure_clone(&*owner->contents.err);
6121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6122 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
6123 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6124 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
6125 int64_t ret_ref = (uintptr_t)ret_copy;
6129 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6130 CHECK(owner->result_ok);
6131 return *owner->contents.result;
6133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6134 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6135 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6138 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6139 CHECK(!owner->result_ok);
6140 return PaymentSendFailure_clone(&*owner->contents.err);
6142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6143 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
6144 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6145 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6146 int64_t ret_ref = (uintptr_t)ret_copy;
6150 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6151 return ThirtyTwoBytes_clone(&owner->a);
6153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6154 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6155 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6156 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
6160 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6161 return ThirtyTwoBytes_clone(&owner->b);
6163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6164 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
6165 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6166 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
6170 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6171 CHECK(owner->result_ok);
6172 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6175 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6176 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6177 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6178 return ((int64_t)ret_conv);
6181 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6182 CHECK(!owner->result_ok);
6183 return PaymentSendFailure_clone(&*owner->contents.err);
6185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6186 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
6187 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6188 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6189 int64_t ret_ref = (uintptr_t)ret_copy;
6193 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
6194 LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
6195 for (size_t i = 0; i < ret.datalen; i++) {
6196 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6200 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6201 return ThirtyTwoBytes_clone(&owner->a);
6203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6204 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6205 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6206 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
6210 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6211 return ThirtyTwoBytes_clone(&owner->b);
6213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6214 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
6215 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6216 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
6220 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6221 CHECK(owner->result_ok);
6222 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6225 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6226 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6227 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6228 return ((int64_t)ret_conv);
6231 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6232 CHECK(!owner->result_ok);
6233 return *owner->contents.err;
6235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6236 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
6237 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6240 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6241 CHECK(owner->result_ok);
6242 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6245 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6246 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6247 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
6248 return ((int64_t)ret_conv);
6251 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6252 CHECK(!owner->result_ok);
6253 return APIError_clone(&*owner->contents.err);
6255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6256 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
6257 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6258 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
6259 int64_t ret_ref = (uintptr_t)ret_copy;
6263 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6264 CHECK(owner->result_ok);
6265 return ThirtyTwoBytes_clone(&*owner->contents.result);
6267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6268 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6269 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6270 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
6274 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6275 CHECK(!owner->result_ok);
6276 return *owner->contents.err;
6278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6279 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
6280 CResult_PaymentSecretNoneZ_get_err(owner_conv);
6283 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6284 CHECK(owner->result_ok);
6285 return ThirtyTwoBytes_clone(&*owner->contents.result);
6287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6288 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6289 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6290 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
6294 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6295 CHECK(!owner->result_ok);
6296 return APIError_clone(&*owner->contents.err);
6298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6299 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
6300 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6301 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
6302 int64_t ret_ref = (uintptr_t)ret_copy;
6306 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6307 CHECK(owner->result_ok);
6308 return ThirtyTwoBytes_clone(&*owner->contents.result);
6310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6311 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6312 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6313 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
6317 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6318 CHECK(!owner->result_ok);
6319 return APIError_clone(&*owner->contents.err);
6321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6322 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
6323 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6324 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6325 int64_t ret_ref = (uintptr_t)ret_copy;
6329 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6330 CHECK(owner->result_ok);
6331 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
6333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6334 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6335 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6336 int64_t ret_ref = 0;
6337 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6338 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6340 ret_ref = (uintptr_t)ret_var.inner;
6341 if (ret_var.is_owned) {
6347 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6348 CHECK(!owner->result_ok);
6349 return DecodeError_clone(&*owner->contents.err);
6351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6352 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
6353 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6354 int64_t ret_ref = 0;
6355 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6356 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6358 ret_ref = (uintptr_t)ret_var.inner;
6359 if (ret_var.is_owned) {
6365 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6366 CHECK(owner->result_ok);
6367 return ChannelCounterparty_clone(&*owner->contents.result);
6369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6370 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6371 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6372 int64_t ret_ref = 0;
6373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6376 ret_ref = (uintptr_t)ret_var.inner;
6377 if (ret_var.is_owned) {
6383 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6384 CHECK(!owner->result_ok);
6385 return DecodeError_clone(&*owner->contents.err);
6387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6388 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
6389 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6390 int64_t ret_ref = 0;
6391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6394 ret_ref = (uintptr_t)ret_var.inner;
6395 if (ret_var.is_owned) {
6401 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6402 CHECK(owner->result_ok);
6403 return ChannelDetails_clone(&*owner->contents.result);
6405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6406 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6407 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6408 int64_t ret_ref = 0;
6409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6412 ret_ref = (uintptr_t)ret_var.inner;
6413 if (ret_var.is_owned) {
6419 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6420 CHECK(!owner->result_ok);
6421 return DecodeError_clone(&*owner->contents.err);
6423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6424 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
6425 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6426 int64_t ret_ref = 0;
6427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6430 ret_ref = (uintptr_t)ret_var.inner;
6431 if (ret_var.is_owned) {
6437 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6438 CHECK(owner->result_ok);
6439 return PhantomRouteHints_clone(&*owner->contents.result);
6441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6442 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6443 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6444 int64_t ret_ref = 0;
6445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6448 ret_ref = (uintptr_t)ret_var.inner;
6449 if (ret_var.is_owned) {
6455 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6456 CHECK(!owner->result_ok);
6457 return DecodeError_clone(&*owner->contents.err);
6459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6460 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
6461 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6462 int64_t ret_ref = 0;
6463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6466 ret_ref = (uintptr_t)ret_var.inner;
6467 if (ret_var.is_owned) {
6473 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6474 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6475 for (size_t i = 0; i < ret.datalen; i++) {
6476 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6480 typedef struct LDKWatch_JCalls {
6481 atomic_size_t refcnt;
6484 jmethodID watch_channel_meth;
6485 jmethodID update_channel_meth;
6486 jmethodID release_pending_monitor_events_meth;
6488 static void LDKWatch_JCalls_free(void* this_arg) {
6489 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6490 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6492 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6493 if (get_jenv_res == JNI_EDETACHED) {
6494 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6496 DO_ASSERT(get_jenv_res == JNI_OK);
6498 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6499 if (get_jenv_res == JNI_EDETACHED) {
6500 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6505 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6506 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6508 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6509 if (get_jenv_res == JNI_EDETACHED) {
6510 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6512 DO_ASSERT(get_jenv_res == JNI_OK);
6514 LDKOutPoint funding_txo_var = funding_txo;
6515 int64_t funding_txo_ref = 0;
6516 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6517 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6518 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6519 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6520 if (funding_txo_var.is_owned) {
6521 funding_txo_ref |= 1;
6523 LDKChannelMonitor monitor_var = monitor;
6524 int64_t monitor_ref = 0;
6525 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6526 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6527 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6528 monitor_ref = (uintptr_t)monitor_var.inner;
6529 if (monitor_var.is_owned) {
6532 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6534 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
6535 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6536 (*env)->ExceptionDescribe(env);
6537 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
6539 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6540 CHECK_ACCESS(ret_ptr);
6541 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6543 if (get_jenv_res == JNI_EDETACHED) {
6544 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6548 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6549 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6551 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6552 if (get_jenv_res == JNI_EDETACHED) {
6553 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6555 DO_ASSERT(get_jenv_res == JNI_OK);
6557 LDKOutPoint funding_txo_var = funding_txo;
6558 int64_t funding_txo_ref = 0;
6559 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6560 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6561 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6562 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
6563 if (funding_txo_var.is_owned) {
6564 funding_txo_ref |= 1;
6566 LDKChannelMonitorUpdate update_var = update;
6567 int64_t update_ref = 0;
6568 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6569 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6570 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6571 update_ref = (uintptr_t)update_var.inner;
6572 if (update_var.is_owned) {
6575 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6577 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6578 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6579 (*env)->ExceptionDescribe(env);
6580 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6582 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6583 CHECK_ACCESS(ret_ptr);
6584 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6586 if (get_jenv_res == JNI_EDETACHED) {
6587 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6591 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6592 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6594 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6595 if (get_jenv_res == JNI_EDETACHED) {
6596 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6598 DO_ASSERT(get_jenv_res == JNI_OK);
6600 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6602 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6603 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6604 (*env)->ExceptionDescribe(env);
6605 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6607 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6608 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6609 if (ret_constr.datalen > 0)
6610 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6612 ret_constr.data = NULL;
6613 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6614 for (size_t x = 0; x < ret_constr.datalen; x++) {
6615 int64_t ret_conv_49 = ret_vals[x];
6616 void* ret_conv_49_ptr = (void*)(((uintptr_t)ret_conv_49) & ~1);
6617 CHECK_ACCESS(ret_conv_49_ptr);
6618 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6619 FREE((void*)ret_conv_49);
6620 ret_constr.data[x] = ret_conv_49_conv;
6622 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6623 if (get_jenv_res == JNI_EDETACHED) {
6624 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6628 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6629 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6630 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6632 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6633 jclass c = (*env)->GetObjectClass(env, o);
6635 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6636 atomic_init(&calls->refcnt, 1);
6637 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6638 calls->o = (*env)->NewWeakGlobalRef(env, o);
6639 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6640 CHECK(calls->watch_channel_meth != NULL);
6641 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6642 CHECK(calls->update_channel_meth != NULL);
6643 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6644 CHECK(calls->release_pending_monitor_events_meth != NULL);
6647 .this_arg = (void*) calls,
6648 .watch_channel = watch_channel_LDKWatch_jcall,
6649 .update_channel = update_channel_LDKWatch_jcall,
6650 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6651 .free = LDKWatch_JCalls_free,
6655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6656 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6657 *res_ptr = LDKWatch_init(env, clz, o);
6658 return (uint64_t)res_ptr;
6660 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) {
6661 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6662 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6663 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6664 LDKOutPoint funding_txo_conv;
6665 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6666 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6667 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6668 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6669 LDKChannelMonitor monitor_conv;
6670 monitor_conv.inner = (void*)(monitor & (~1));
6671 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
6672 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6673 monitor_conv = ChannelMonitor_clone(&monitor_conv);
6674 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6675 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6676 return (int64_t)ret_conv;
6679 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) {
6680 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6681 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6682 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6683 LDKOutPoint funding_txo_conv;
6684 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6685 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6686 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6687 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6688 LDKChannelMonitorUpdate update_conv;
6689 update_conv.inner = (void*)(update & (~1));
6690 update_conv.is_owned = (update & 1) || (update == 0);
6691 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6692 update_conv = ChannelMonitorUpdate_clone(&update_conv);
6693 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6694 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6695 return (int64_t)ret_conv;
6698 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6699 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6700 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6701 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6702 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6703 int64_tArray ret_arr = NULL;
6704 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6705 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6706 for (size_t x = 0; x < ret_var.datalen; x++) {
6707 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6708 *ret_conv_49_conv = ret_var.data[x];
6709 ret_arr_ptr[x] = ((int64_t)ret_conv_49_conv);
6711 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6716 typedef struct LDKBroadcasterInterface_JCalls {
6717 atomic_size_t refcnt;
6720 jmethodID broadcast_transaction_meth;
6721 } LDKBroadcasterInterface_JCalls;
6722 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6723 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6724 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6726 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6727 if (get_jenv_res == JNI_EDETACHED) {
6728 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6730 DO_ASSERT(get_jenv_res == JNI_OK);
6732 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6733 if (get_jenv_res == JNI_EDETACHED) {
6734 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6739 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6740 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6742 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6743 if (get_jenv_res == JNI_EDETACHED) {
6744 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6746 DO_ASSERT(get_jenv_res == JNI_OK);
6748 LDKTransaction tx_var = tx;
6749 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
6750 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
6751 Transaction_free(tx_var);
6752 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6754 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
6755 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6756 (*env)->ExceptionDescribe(env);
6757 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
6759 if (get_jenv_res == JNI_EDETACHED) {
6760 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6763 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6764 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6765 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6767 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
6768 jclass c = (*env)->GetObjectClass(env, o);
6770 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6771 atomic_init(&calls->refcnt, 1);
6772 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6773 calls->o = (*env)->NewWeakGlobalRef(env, o);
6774 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
6775 CHECK(calls->broadcast_transaction_meth != NULL);
6777 LDKBroadcasterInterface ret = {
6778 .this_arg = (void*) calls,
6779 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6780 .free = LDKBroadcasterInterface_JCalls_free,
6784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6785 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6786 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
6787 return (uint64_t)res_ptr;
6789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
6790 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6791 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6792 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6793 LDKTransaction tx_ref;
6794 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
6795 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6796 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
6797 tx_ref.data_is_owned = true;
6798 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6801 typedef struct LDKKeysInterface_JCalls {
6802 atomic_size_t refcnt;
6805 jmethodID get_node_secret_meth;
6806 jmethodID get_destination_script_meth;
6807 jmethodID get_shutdown_scriptpubkey_meth;
6808 jmethodID get_channel_signer_meth;
6809 jmethodID get_secure_random_bytes_meth;
6810 jmethodID read_chan_signer_meth;
6811 jmethodID sign_invoice_meth;
6812 jmethodID get_inbound_payment_key_material_meth;
6813 } LDKKeysInterface_JCalls;
6814 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6815 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6816 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6818 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6819 if (get_jenv_res == JNI_EDETACHED) {
6820 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6822 DO_ASSERT(get_jenv_res == JNI_OK);
6824 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6825 if (get_jenv_res == JNI_EDETACHED) {
6826 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6831 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
6832 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6834 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6835 if (get_jenv_res == JNI_EDETACHED) {
6836 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6838 DO_ASSERT(get_jenv_res == JNI_OK);
6840 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
6841 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6843 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
6844 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6845 (*env)->ExceptionDescribe(env);
6846 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
6848 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6849 CHECK_ACCESS(ret_ptr);
6850 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
6852 if (get_jenv_res == JNI_EDETACHED) {
6853 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6857 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6858 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6860 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6861 if (get_jenv_res == JNI_EDETACHED) {
6862 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6864 DO_ASSERT(get_jenv_res == JNI_OK);
6866 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6868 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
6869 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6870 (*env)->ExceptionDescribe(env);
6871 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
6873 LDKCVec_u8Z ret_ref;
6874 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6875 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6876 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6877 if (get_jenv_res == JNI_EDETACHED) {
6878 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6882 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6883 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6885 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6886 if (get_jenv_res == JNI_EDETACHED) {
6887 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6889 DO_ASSERT(get_jenv_res == JNI_OK);
6891 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6893 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
6894 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6895 (*env)->ExceptionDescribe(env);
6896 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
6898 LDKShutdownScript ret_conv;
6899 ret_conv.inner = (void*)(ret & (~1));
6900 ret_conv.is_owned = (ret & 1) || (ret == 0);
6901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6902 if (get_jenv_res == JNI_EDETACHED) {
6903 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6907 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6908 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6910 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6911 if (get_jenv_res == JNI_EDETACHED) {
6912 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6914 DO_ASSERT(get_jenv_res == JNI_OK);
6916 jboolean inbound_conv = inbound;
6917 int64_t channel_value_satoshis_conv = channel_value_satoshis;
6918 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6920 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
6921 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6922 (*env)->ExceptionDescribe(env);
6923 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
6925 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6926 CHECK_ACCESS(ret_ptr);
6927 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6929 if (get_jenv_res == JNI_EDETACHED) {
6930 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6934 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6935 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6937 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6938 if (get_jenv_res == JNI_EDETACHED) {
6939 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6941 DO_ASSERT(get_jenv_res == JNI_OK);
6943 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6945 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
6946 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6947 (*env)->ExceptionDescribe(env);
6948 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
6950 LDKThirtyTwoBytes ret_ref;
6951 CHECK((*env)->GetArrayLength(env, ret) == 32);
6952 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6953 if (get_jenv_res == JNI_EDETACHED) {
6954 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6958 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6959 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6961 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6962 if (get_jenv_res == JNI_EDETACHED) {
6963 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6965 DO_ASSERT(get_jenv_res == JNI_OK);
6967 LDKu8slice reader_var = reader;
6968 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
6969 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
6970 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6972 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
6973 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6974 (*env)->ExceptionDescribe(env);
6975 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
6977 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6978 CHECK_ACCESS(ret_ptr);
6979 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6981 if (get_jenv_res == JNI_EDETACHED) {
6982 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6986 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6987 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6989 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6990 if (get_jenv_res == JNI_EDETACHED) {
6991 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6993 DO_ASSERT(get_jenv_res == JNI_OK);
6995 LDKu8slice hrp_bytes_var = hrp_bytes;
6996 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6997 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
6998 LDKCVec_u5Z invoice_data_var = invoice_data;
6999 jobjectArray invoice_data_arr = NULL;
7000 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
7001 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
7002 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7003 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7004 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7006 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
7007 FREE(invoice_data_var.data);
7008 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
7009 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7011 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
7012 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7013 (*env)->ExceptionDescribe(env);
7014 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
7016 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
7017 CHECK_ACCESS(ret_ptr);
7018 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7020 if (get_jenv_res == JNI_EDETACHED) {
7021 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7025 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
7026 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7028 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7029 if (get_jenv_res == JNI_EDETACHED) {
7030 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7032 DO_ASSERT(get_jenv_res == JNI_OK);
7034 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7036 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7037 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7038 (*env)->ExceptionDescribe(env);
7039 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
7041 LDKThirtyTwoBytes ret_ref;
7042 CHECK((*env)->GetArrayLength(env, ret) == 32);
7043 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7044 if (get_jenv_res == JNI_EDETACHED) {
7045 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7049 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
7050 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
7051 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7053 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
7054 jclass c = (*env)->GetObjectClass(env, o);
7056 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
7057 atomic_init(&calls->refcnt, 1);
7058 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7059 calls->o = (*env)->NewWeakGlobalRef(env, o);
7060 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
7061 CHECK(calls->get_node_secret_meth != NULL);
7062 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
7063 CHECK(calls->get_destination_script_meth != NULL);
7064 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
7065 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
7066 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
7067 CHECK(calls->get_channel_signer_meth != NULL);
7068 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7069 CHECK(calls->get_secure_random_bytes_meth != NULL);
7070 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
7071 CHECK(calls->read_chan_signer_meth != NULL);
7072 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
7073 CHECK(calls->sign_invoice_meth != NULL);
7074 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
7075 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
7077 LDKKeysInterface ret = {
7078 .this_arg = (void*) calls,
7079 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
7080 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
7081 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
7082 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
7083 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
7084 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
7085 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
7086 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
7087 .free = LDKKeysInterface_JCalls_free,
7091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7092 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7093 *res_ptr = LDKKeysInterface_init(env, clz, o);
7094 return (uint64_t)res_ptr;
7096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
7097 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7098 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7099 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7100 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7101 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
7102 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
7103 return (int64_t)ret_conv;
7106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
7107 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7108 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7109 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7110 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
7111 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7112 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7113 CVec_u8Z_free(ret_var);
7117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
7118 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7119 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7120 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7121 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7122 int64_t ret_ref = 0;
7123 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7124 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7126 ret_ref = (uintptr_t)ret_var.inner;
7127 if (ret_var.is_owned) {
7133 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) {
7134 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7135 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7136 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7137 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
7138 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
7139 return (int64_t)ret_ret;
7142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7143 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7144 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7145 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7146 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7147 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
7152 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7153 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7154 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7155 LDKu8slice reader_ref;
7156 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
7157 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
7158 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7159 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7160 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
7161 return (int64_t)ret_conv;
7164 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) {
7165 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7166 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7167 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7168 LDKu8slice hrp_bytes_ref;
7169 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
7170 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
7171 LDKCVec_u5Z invoice_data_constr;
7172 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
7173 if (invoice_data_constr.datalen > 0)
7174 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
7176 invoice_data_constr.data = NULL;
7177 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
7178 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
7179 int8_t invoice_data_conv_7 = invoice_data_vals[h];
7181 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
7183 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
7184 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
7185 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7186 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
7187 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
7188 return (int64_t)ret_conv;
7191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
7192 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7193 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7194 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7195 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7196 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
7200 typedef struct LDKFeeEstimator_JCalls {
7201 atomic_size_t refcnt;
7204 jmethodID get_est_sat_per_1000_weight_meth;
7205 } LDKFeeEstimator_JCalls;
7206 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7207 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7208 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7210 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7211 if (get_jenv_res == JNI_EDETACHED) {
7212 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7214 DO_ASSERT(get_jenv_res == JNI_OK);
7216 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7217 if (get_jenv_res == JNI_EDETACHED) {
7218 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7223 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7224 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7226 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7227 if (get_jenv_res == JNI_EDETACHED) {
7228 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7230 DO_ASSERT(get_jenv_res == JNI_OK);
7232 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
7233 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7235 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
7236 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7237 (*env)->ExceptionDescribe(env);
7238 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
7240 if (get_jenv_res == JNI_EDETACHED) {
7241 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7245 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7246 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7247 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7249 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
7250 jclass c = (*env)->GetObjectClass(env, o);
7252 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7253 atomic_init(&calls->refcnt, 1);
7254 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7255 calls->o = (*env)->NewWeakGlobalRef(env, o);
7256 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
7257 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
7259 LDKFeeEstimator ret = {
7260 .this_arg = (void*) calls,
7261 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7262 .free = LDKFeeEstimator_JCalls_free,
7266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
7267 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7268 *res_ptr = LDKFeeEstimator_init(env, clz, o);
7269 return (uint64_t)res_ptr;
7271 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) {
7272 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7273 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7274 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7275 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
7276 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7280 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7281 return ThirtyTwoBytes_clone(&owner->a);
7283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7284 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
7285 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7286 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
7290 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7294 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
7295 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
7296 int64_t ret_ref = 0;
7297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7300 ret_ref = (uintptr_t)ret_var.inner & ~1;
7304 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7305 CHECK(owner->result_ok);
7306 return &*owner->contents.result;
7308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7309 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7310 int64_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
7314 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7315 CHECK(!owner->result_ok);
7316 return DecodeError_clone(&*owner->contents.err);
7318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7319 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
7320 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
7321 int64_t ret_ref = 0;
7322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7325 ret_ref = (uintptr_t)ret_var.inner;
7326 if (ret_var.is_owned) {
7332 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7333 CHECK(owner->result_ok);
7334 return ChannelConfig_clone(&*owner->contents.result);
7336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7337 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7338 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7339 int64_t ret_ref = 0;
7340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7343 ret_ref = (uintptr_t)ret_var.inner;
7344 if (ret_var.is_owned) {
7350 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7351 CHECK(!owner->result_ok);
7352 return DecodeError_clone(&*owner->contents.err);
7354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7355 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
7356 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7357 int64_t ret_ref = 0;
7358 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7359 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7361 ret_ref = (uintptr_t)ret_var.inner;
7362 if (ret_var.is_owned) {
7368 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7369 CHECK(owner->result_ok);
7370 return OutPoint_clone(&*owner->contents.result);
7372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7373 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7374 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
7375 int64_t ret_ref = 0;
7376 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7377 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7378 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7379 ret_ref = (uintptr_t)ret_var.inner;
7380 if (ret_var.is_owned) {
7386 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7387 CHECK(!owner->result_ok);
7388 return DecodeError_clone(&*owner->contents.err);
7390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7391 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
7392 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
7393 int64_t ret_ref = 0;
7394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7397 ret_ref = (uintptr_t)ret_var.inner;
7398 if (ret_var.is_owned) {
7404 typedef struct LDKType_JCalls {
7405 atomic_size_t refcnt;
7408 jmethodID type_id_meth;
7409 jmethodID debug_str_meth;
7410 jmethodID write_meth;
7412 static void LDKType_JCalls_free(void* this_arg) {
7413 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7414 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7416 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7417 if (get_jenv_res == JNI_EDETACHED) {
7418 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7420 DO_ASSERT(get_jenv_res == JNI_OK);
7422 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7423 if (get_jenv_res == JNI_EDETACHED) {
7424 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7429 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7430 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7432 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7433 if (get_jenv_res == JNI_EDETACHED) {
7434 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7436 DO_ASSERT(get_jenv_res == JNI_OK);
7438 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7440 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
7441 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7442 (*env)->ExceptionDescribe(env);
7443 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
7445 if (get_jenv_res == JNI_EDETACHED) {
7446 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7450 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7451 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7453 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7454 if (get_jenv_res == JNI_EDETACHED) {
7455 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7457 DO_ASSERT(get_jenv_res == JNI_OK);
7459 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7461 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
7462 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7463 (*env)->ExceptionDescribe(env);
7464 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
7466 LDKStr ret_conv = java_to_owned_str(env, ret);
7467 if (get_jenv_res == JNI_EDETACHED) {
7468 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7472 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7473 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7475 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7476 if (get_jenv_res == JNI_EDETACHED) {
7477 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7479 DO_ASSERT(get_jenv_res == JNI_OK);
7481 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7483 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
7484 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7485 (*env)->ExceptionDescribe(env);
7486 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
7488 LDKCVec_u8Z ret_ref;
7489 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7490 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7491 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7492 if (get_jenv_res == JNI_EDETACHED) {
7493 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7497 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7498 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7499 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7501 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
7502 jclass c = (*env)->GetObjectClass(env, o);
7504 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7505 atomic_init(&calls->refcnt, 1);
7506 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7507 calls->o = (*env)->NewWeakGlobalRef(env, o);
7508 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
7509 CHECK(calls->type_id_meth != NULL);
7510 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
7511 CHECK(calls->debug_str_meth != NULL);
7512 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
7513 CHECK(calls->write_meth != NULL);
7516 .this_arg = (void*) calls,
7517 .type_id = type_id_LDKType_jcall,
7518 .debug_str = debug_str_LDKType_jcall,
7519 .write = write_LDKType_jcall,
7520 .cloned = LDKType_JCalls_cloned,
7521 .free = LDKType_JCalls_free,
7525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
7526 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7527 *res_ptr = LDKType_init(env, clz, o);
7528 return (uint64_t)res_ptr;
7530 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
7531 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7532 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7533 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7534 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7538 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
7539 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7540 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7541 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7542 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7543 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
7549 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7550 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7551 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7552 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7553 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7554 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7555 CVec_u8Z_free(ret_var);
7559 static jclass LDKCOption_TypeZ_Some_class = NULL;
7560 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
7561 static jclass LDKCOption_TypeZ_None_class = NULL;
7562 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
7563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
7564 LDKCOption_TypeZ_Some_class =
7565 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
7566 CHECK(LDKCOption_TypeZ_Some_class != NULL);
7567 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
7568 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
7569 LDKCOption_TypeZ_None_class =
7570 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
7571 CHECK(LDKCOption_TypeZ_None_class != NULL);
7572 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
7573 CHECK(LDKCOption_TypeZ_None_meth != NULL);
7575 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7576 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
7578 case LDKCOption_TypeZ_Some: {
7579 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7580 *some_ret = Type_clone(&obj->some);
7581 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (int64_t)some_ret);
7583 case LDKCOption_TypeZ_None: {
7584 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
7589 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7590 CHECK(owner->result_ok);
7591 return COption_TypeZ_clone(&*owner->contents.result);
7593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7594 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7595 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7596 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7597 int64_t ret_ref = (uintptr_t)ret_copy;
7601 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7602 CHECK(!owner->result_ok);
7603 return DecodeError_clone(&*owner->contents.err);
7605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7606 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
7607 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7608 int64_t ret_ref = 0;
7609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7612 ret_ref = (uintptr_t)ret_var.inner;
7613 if (ret_var.is_owned) {
7619 static jclass LDKPaymentError_Invoice_class = NULL;
7620 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7621 static jclass LDKPaymentError_Routing_class = NULL;
7622 static jmethodID LDKPaymentError_Routing_meth = NULL;
7623 static jclass LDKPaymentError_Sending_class = NULL;
7624 static jmethodID LDKPaymentError_Sending_meth = NULL;
7625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7626 LDKPaymentError_Invoice_class =
7627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7628 CHECK(LDKPaymentError_Invoice_class != NULL);
7629 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7630 CHECK(LDKPaymentError_Invoice_meth != NULL);
7631 LDKPaymentError_Routing_class =
7632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7633 CHECK(LDKPaymentError_Routing_class != NULL);
7634 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7635 CHECK(LDKPaymentError_Routing_meth != NULL);
7636 LDKPaymentError_Sending_class =
7637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7638 CHECK(LDKPaymentError_Sending_class != NULL);
7639 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7640 CHECK(LDKPaymentError_Sending_meth != NULL);
7642 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7643 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
7645 case LDKPaymentError_Invoice: {
7646 LDKStr invoice_str = obj->invoice;
7647 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7648 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7650 case LDKPaymentError_Routing: {
7651 LDKLightningError routing_var = obj->routing;
7652 int64_t routing_ref = 0;
7653 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7654 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7655 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7656 routing_ref = (uintptr_t)routing_var.inner & ~1;
7657 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7659 case LDKPaymentError_Sending: {
7660 int64_t sending_ref = ((uintptr_t)&obj->sending) | 1;
7661 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7666 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7667 CHECK(owner->result_ok);
7668 return ThirtyTwoBytes_clone(&*owner->contents.result);
7670 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7671 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7672 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7673 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7677 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7678 CHECK(!owner->result_ok);
7679 return PaymentError_clone(&*owner->contents.err);
7681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7682 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
7683 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7684 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7685 int64_t ret_ref = (uintptr_t)ret_copy;
7689 static jclass LDKParseError_Bech32Error_class = NULL;
7690 static jmethodID LDKParseError_Bech32Error_meth = NULL;
7691 static jclass LDKParseError_ParseAmountError_class = NULL;
7692 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
7693 static jclass LDKParseError_MalformedSignature_class = NULL;
7694 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
7695 static jclass LDKParseError_BadPrefix_class = NULL;
7696 static jmethodID LDKParseError_BadPrefix_meth = NULL;
7697 static jclass LDKParseError_UnknownCurrency_class = NULL;
7698 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
7699 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
7700 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
7701 static jclass LDKParseError_MalformedHRP_class = NULL;
7702 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
7703 static jclass LDKParseError_TooShortDataPart_class = NULL;
7704 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
7705 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
7706 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
7707 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
7708 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
7709 static jclass LDKParseError_PaddingError_class = NULL;
7710 static jmethodID LDKParseError_PaddingError_meth = NULL;
7711 static jclass LDKParseError_IntegerOverflowError_class = NULL;
7712 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
7713 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
7714 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
7715 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
7716 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
7717 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
7718 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
7719 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
7720 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
7721 static jclass LDKParseError_InvalidSliceLength_class = NULL;
7722 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
7723 static jclass LDKParseError_Skip_class = NULL;
7724 static jmethodID LDKParseError_Skip_meth = NULL;
7725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
7726 LDKParseError_Bech32Error_class =
7727 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
7728 CHECK(LDKParseError_Bech32Error_class != NULL);
7729 LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
7730 CHECK(LDKParseError_Bech32Error_meth != NULL);
7731 LDKParseError_ParseAmountError_class =
7732 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
7733 CHECK(LDKParseError_ParseAmountError_class != NULL);
7734 LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
7735 CHECK(LDKParseError_ParseAmountError_meth != NULL);
7736 LDKParseError_MalformedSignature_class =
7737 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
7738 CHECK(LDKParseError_MalformedSignature_class != NULL);
7739 LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
7740 CHECK(LDKParseError_MalformedSignature_meth != NULL);
7741 LDKParseError_BadPrefix_class =
7742 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
7743 CHECK(LDKParseError_BadPrefix_class != NULL);
7744 LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
7745 CHECK(LDKParseError_BadPrefix_meth != NULL);
7746 LDKParseError_UnknownCurrency_class =
7747 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
7748 CHECK(LDKParseError_UnknownCurrency_class != NULL);
7749 LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
7750 CHECK(LDKParseError_UnknownCurrency_meth != NULL);
7751 LDKParseError_UnknownSiPrefix_class =
7752 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
7753 CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
7754 LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
7755 CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
7756 LDKParseError_MalformedHRP_class =
7757 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
7758 CHECK(LDKParseError_MalformedHRP_class != NULL);
7759 LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
7760 CHECK(LDKParseError_MalformedHRP_meth != NULL);
7761 LDKParseError_TooShortDataPart_class =
7762 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
7763 CHECK(LDKParseError_TooShortDataPart_class != NULL);
7764 LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
7765 CHECK(LDKParseError_TooShortDataPart_meth != NULL);
7766 LDKParseError_UnexpectedEndOfTaggedFields_class =
7767 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
7768 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
7769 LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
7770 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
7771 LDKParseError_DescriptionDecodeError_class =
7772 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
7773 CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
7774 LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
7775 CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
7776 LDKParseError_PaddingError_class =
7777 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
7778 CHECK(LDKParseError_PaddingError_class != NULL);
7779 LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
7780 CHECK(LDKParseError_PaddingError_meth != NULL);
7781 LDKParseError_IntegerOverflowError_class =
7782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
7783 CHECK(LDKParseError_IntegerOverflowError_class != NULL);
7784 LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
7785 CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
7786 LDKParseError_InvalidSegWitProgramLength_class =
7787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
7788 CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
7789 LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
7790 CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
7791 LDKParseError_InvalidPubKeyHashLength_class =
7792 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
7793 CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
7794 LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
7795 CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
7796 LDKParseError_InvalidScriptHashLength_class =
7797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
7798 CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
7799 LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
7800 CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
7801 LDKParseError_InvalidRecoveryId_class =
7802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
7803 CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
7804 LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
7805 CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
7806 LDKParseError_InvalidSliceLength_class =
7807 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
7808 CHECK(LDKParseError_InvalidSliceLength_class != NULL);
7809 LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
7810 CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
7811 LDKParseError_Skip_class =
7812 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
7813 CHECK(LDKParseError_Skip_class != NULL);
7814 LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
7815 CHECK(LDKParseError_Skip_meth != NULL);
7817 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7818 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
7820 case LDKParseError_Bech32Error: {
7821 int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
7822 return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
7824 case LDKParseError_ParseAmountError: {
7825 /*obj->parse_amount_error*/
7826 return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
7828 case LDKParseError_MalformedSignature: {
7829 jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
7830 return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
7832 case LDKParseError_BadPrefix: {
7833 return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
7835 case LDKParseError_UnknownCurrency: {
7836 return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
7838 case LDKParseError_UnknownSiPrefix: {
7839 return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
7841 case LDKParseError_MalformedHRP: {
7842 return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
7844 case LDKParseError_TooShortDataPart: {
7845 return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
7847 case LDKParseError_UnexpectedEndOfTaggedFields: {
7848 return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
7850 case LDKParseError_DescriptionDecodeError: {
7851 /*obj->description_decode_error*/
7852 return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
7854 case LDKParseError_PaddingError: {
7855 return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
7857 case LDKParseError_IntegerOverflowError: {
7858 return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
7860 case LDKParseError_InvalidSegWitProgramLength: {
7861 return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
7863 case LDKParseError_InvalidPubKeyHashLength: {
7864 return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
7866 case LDKParseError_InvalidScriptHashLength: {
7867 return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
7869 case LDKParseError_InvalidRecoveryId: {
7870 return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
7872 case LDKParseError_InvalidSliceLength: {
7873 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7874 jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
7875 return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
7877 case LDKParseError_Skip: {
7878 return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
7883 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7884 CHECK(owner->result_ok);
7885 return SiPrefix_clone(&*owner->contents.result);
7887 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7888 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7889 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7893 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7894 CHECK(!owner->result_ok);
7895 return ParseError_clone(&*owner->contents.err);
7897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7898 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
7899 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7900 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7901 int64_t ret_ref = (uintptr_t)ret_copy;
7905 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7906 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7907 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7908 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7910 LDKParseOrSemanticError_ParseError_class =
7911 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7912 CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7913 LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7914 CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7915 LDKParseOrSemanticError_SemanticError_class =
7916 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7917 CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7918 LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7919 CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7921 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7922 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
7924 case LDKParseOrSemanticError_ParseError: {
7925 int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
7926 return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7928 case LDKParseOrSemanticError_SemanticError: {
7929 jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7930 return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7935 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7936 CHECK(owner->result_ok);
7937 return Invoice_clone(&*owner->contents.result);
7939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7940 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7941 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7942 int64_t ret_ref = 0;
7943 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7944 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7946 ret_ref = (uintptr_t)ret_var.inner;
7947 if (ret_var.is_owned) {
7953 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7954 CHECK(!owner->result_ok);
7955 return ParseOrSemanticError_clone(&*owner->contents.err);
7957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7958 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7959 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7960 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7961 int64_t ret_ref = (uintptr_t)ret_copy;
7965 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7966 CHECK(owner->result_ok);
7967 return SignedRawInvoice_clone(&*owner->contents.result);
7969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7970 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7971 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7972 int64_t ret_ref = 0;
7973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7976 ret_ref = (uintptr_t)ret_var.inner;
7977 if (ret_var.is_owned) {
7983 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7984 CHECK(!owner->result_ok);
7985 return ParseError_clone(&*owner->contents.err);
7987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7988 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7989 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7990 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7991 int64_t ret_ref = (uintptr_t)ret_copy;
7995 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7996 return RawInvoice_clone(&owner->a);
7998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7999 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
8000 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
8001 int64_t ret_ref = 0;
8002 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8003 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8005 ret_ref = (uintptr_t)ret_var.inner;
8006 if (ret_var.is_owned) {
8012 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8013 return ThirtyTwoBytes_clone(&owner->b);
8015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8016 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
8017 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8018 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
8022 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8023 return InvoiceSignature_clone(&owner->c);
8025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
8026 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
8027 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
8028 int64_t ret_ref = 0;
8029 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8030 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8032 ret_ref = (uintptr_t)ret_var.inner;
8033 if (ret_var.is_owned) {
8039 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8040 CHECK(owner->result_ok);
8041 return PayeePubKey_clone(&*owner->contents.result);
8043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8044 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
8045 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
8046 int64_t ret_ref = 0;
8047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8050 ret_ref = (uintptr_t)ret_var.inner;
8051 if (ret_var.is_owned) {
8057 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8058 CHECK(!owner->result_ok);
8059 return *owner->contents.err;
8061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8062 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
8063 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
8067 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
8068 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
8069 for (size_t i = 0; i < ret.datalen; i++) {
8070 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
8074 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8075 CHECK(owner->result_ok);
8076 return PositiveTimestamp_clone(&*owner->contents.result);
8078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8079 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
8080 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
8081 int64_t ret_ref = 0;
8082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8085 ret_ref = (uintptr_t)ret_var.inner;
8086 if (ret_var.is_owned) {
8092 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8093 CHECK(!owner->result_ok);
8094 return CreationError_clone(&*owner->contents.err);
8096 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8097 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
8098 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
8102 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8103 CHECK(owner->result_ok);
8104 return *owner->contents.result;
8106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8107 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
8108 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
8111 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8112 CHECK(!owner->result_ok);
8113 return SemanticError_clone(&*owner->contents.err);
8115 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8116 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
8117 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
8121 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8122 CHECK(owner->result_ok);
8123 return Invoice_clone(&*owner->contents.result);
8125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8126 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
8127 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
8128 int64_t ret_ref = 0;
8129 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8130 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8132 ret_ref = (uintptr_t)ret_var.inner;
8133 if (ret_var.is_owned) {
8139 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8140 CHECK(!owner->result_ok);
8141 return SemanticError_clone(&*owner->contents.err);
8143 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8144 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
8145 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
8149 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8150 CHECK(owner->result_ok);
8151 return Description_clone(&*owner->contents.result);
8153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8154 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
8155 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
8156 int64_t ret_ref = 0;
8157 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8158 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8160 ret_ref = (uintptr_t)ret_var.inner;
8161 if (ret_var.is_owned) {
8167 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8168 CHECK(!owner->result_ok);
8169 return CreationError_clone(&*owner->contents.err);
8171 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8172 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
8173 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
8177 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
8178 CHECK(owner->result_ok);
8179 return PrivateRoute_clone(&*owner->contents.result);
8181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8182 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
8183 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
8184 int64_t ret_ref = 0;
8185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8188 ret_ref = (uintptr_t)ret_var.inner;
8189 if (ret_var.is_owned) {
8195 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
8196 CHECK(!owner->result_ok);
8197 return CreationError_clone(&*owner->contents.err);
8199 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8200 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
8201 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
8205 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8206 CHECK(owner->result_ok);
8207 return *owner->contents.result;
8209 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8210 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
8211 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
8212 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8216 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8217 CHECK(!owner->result_ok);
8218 return *owner->contents.err;
8220 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8221 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
8222 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
8226 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8227 CHECK(owner->result_ok);
8228 return ChannelMonitorUpdate_clone(&*owner->contents.result);
8230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8231 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
8232 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8233 int64_t ret_ref = 0;
8234 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8235 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8236 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8237 ret_ref = (uintptr_t)ret_var.inner;
8238 if (ret_var.is_owned) {
8244 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8245 CHECK(!owner->result_ok);
8246 return DecodeError_clone(&*owner->contents.err);
8248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8249 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
8250 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8251 int64_t ret_ref = 0;
8252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8255 ret_ref = (uintptr_t)ret_var.inner;
8256 if (ret_var.is_owned) {
8262 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
8263 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
8264 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
8265 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
8266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
8267 LDKCOption_MonitorEventZ_Some_class =
8268 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
8269 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
8270 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
8271 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
8272 LDKCOption_MonitorEventZ_None_class =
8273 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
8274 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
8275 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
8276 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
8278 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8279 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
8281 case LDKCOption_MonitorEventZ_Some: {
8282 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
8283 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
8285 case LDKCOption_MonitorEventZ_None: {
8286 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
8291 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8292 CHECK(owner->result_ok);
8293 return COption_MonitorEventZ_clone(&*owner->contents.result);
8295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8296 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
8297 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8298 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8299 int64_t ret_ref = (uintptr_t)ret_copy;
8303 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8304 CHECK(!owner->result_ok);
8305 return DecodeError_clone(&*owner->contents.err);
8307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8308 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
8309 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8310 int64_t ret_ref = 0;
8311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8314 ret_ref = (uintptr_t)ret_var.inner;
8315 if (ret_var.is_owned) {
8321 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8322 CHECK(owner->result_ok);
8323 return HTLCUpdate_clone(&*owner->contents.result);
8325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8326 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8327 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8328 int64_t ret_ref = 0;
8329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8332 ret_ref = (uintptr_t)ret_var.inner;
8333 if (ret_var.is_owned) {
8339 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8340 CHECK(!owner->result_ok);
8341 return DecodeError_clone(&*owner->contents.err);
8343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8344 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
8345 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8346 int64_t ret_ref = 0;
8347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8350 ret_ref = (uintptr_t)ret_var.inner;
8351 if (ret_var.is_owned) {
8357 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8358 return OutPoint_clone(&owner->a);
8360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8361 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8362 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
8363 int64_t ret_ref = 0;
8364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8367 ret_ref = (uintptr_t)ret_var.inner;
8368 if (ret_var.is_owned) {
8374 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8375 return CVec_u8Z_clone(&owner->b);
8377 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8378 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
8379 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
8380 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8381 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8382 CVec_u8Z_free(ret_var);
8386 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8389 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8390 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8391 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
8395 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8396 return CVec_u8Z_clone(&owner->b);
8398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8399 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
8400 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
8401 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8402 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8403 CVec_u8Z_free(ret_var);
8407 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
8408 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
8409 for (size_t i = 0; i < ret.datalen; i++) {
8410 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
8414 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8415 return ThirtyTwoBytes_clone(&owner->a);
8417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8418 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8419 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8420 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
8424 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8425 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
8427 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8428 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
8429 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
8430 int64_tArray ret_arr = NULL;
8431 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8432 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8433 for (size_t v = 0; v < ret_var.datalen; v++) {
8434 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8435 *ret_conv_21_conv = ret_var.data[v];
8436 ret_arr_ptr[v] = ((int64_t)ret_conv_21_conv);
8438 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8443 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8444 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 };
8445 for (size_t i = 0; i < ret.datalen; i++) {
8446 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8450 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
8451 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
8452 for (size_t i = 0; i < ret.datalen; i++) {
8453 ret.data[i] = Event_clone(&orig->data[i]);
8457 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8460 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8461 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8462 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8466 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8467 return TxOut_clone(&owner->b);
8469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8470 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
8471 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8472 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8473 return (int64_t)ret_ref;
8476 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8477 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8478 for (size_t i = 0; i < ret.datalen; i++) {
8479 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8483 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8484 return ThirtyTwoBytes_clone(&owner->a);
8486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8487 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8488 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
8493 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8494 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8496 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8497 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
8498 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8499 int64_tArray ret_arr = NULL;
8500 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8501 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8502 for (size_t u = 0; u < ret_var.datalen; u++) {
8503 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8504 *ret_conv_20_conv = ret_var.data[u];
8505 ret_arr_ptr[u] = ((int64_t)ret_conv_20_conv);
8507 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8512 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8513 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 };
8514 for (size_t i = 0; i < ret.datalen; i++) {
8515 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8519 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
8520 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
8521 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
8522 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
8523 static jclass LDKBalance_ContentiousClaimable_class = NULL;
8524 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
8525 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
8526 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
8527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
8528 LDKBalance_ClaimableOnChannelClose_class =
8529 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
8530 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
8531 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
8532 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
8533 LDKBalance_ClaimableAwaitingConfirmations_class =
8534 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
8535 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
8536 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
8537 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
8538 LDKBalance_ContentiousClaimable_class =
8539 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
8540 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
8541 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
8542 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
8543 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
8544 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
8545 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
8546 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
8547 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
8549 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8550 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
8552 case LDKBalance_ClaimableOnChannelClose: {
8553 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
8554 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
8556 case LDKBalance_ClaimableAwaitingConfirmations: {
8557 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
8558 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8559 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
8561 case LDKBalance_ContentiousClaimable: {
8562 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
8563 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8564 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
8566 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
8567 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
8568 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
8569 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
8574 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8575 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8576 for (size_t i = 0; i < ret.datalen; i++) {
8577 ret.data[i] = Balance_clone(&orig->data[i]);
8581 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8582 CHECK(owner->result_ok);
8583 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8586 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8587 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8588 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8589 return ((int64_t)ret_conv);
8592 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8593 CHECK(!owner->result_ok);
8594 return DecodeError_clone(&*owner->contents.err);
8596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8597 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
8598 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8599 int64_t ret_ref = 0;
8600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8603 ret_ref = (uintptr_t)ret_var.inner;
8604 if (ret_var.is_owned) {
8610 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8614 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8615 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8616 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
8620 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8621 return Type_clone(&owner->b);
8623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8624 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
8625 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8626 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8627 return (int64_t)ret_ret;
8630 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8631 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8632 for (size_t i = 0; i < ret.datalen; i++) {
8633 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8637 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
8638 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
8639 static jclass LDKCOption_NetAddressZ_None_class = NULL;
8640 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
8641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
8642 LDKCOption_NetAddressZ_Some_class =
8643 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
8644 CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
8645 LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
8646 CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
8647 LDKCOption_NetAddressZ_None_class =
8648 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
8649 CHECK(LDKCOption_NetAddressZ_None_class != NULL);
8650 LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
8651 CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
8653 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8654 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
8656 case LDKCOption_NetAddressZ_Some: {
8657 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
8658 return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
8660 case LDKCOption_NetAddressZ_None: {
8661 return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
8666 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8667 CHECK(owner->result_ok);
8668 return CVec_u8Z_clone(&*owner->contents.result);
8670 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8671 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8672 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8673 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8674 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8675 CVec_u8Z_free(ret_var);
8679 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8680 CHECK(!owner->result_ok);
8681 return PeerHandleError_clone(&*owner->contents.err);
8683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8684 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
8685 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8686 int64_t ret_ref = 0;
8687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8690 ret_ref = (uintptr_t)ret_var.inner;
8691 if (ret_var.is_owned) {
8697 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8698 CHECK(owner->result_ok);
8699 return *owner->contents.result;
8701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8702 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8703 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8706 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8707 CHECK(!owner->result_ok);
8708 return PeerHandleError_clone(&*owner->contents.err);
8710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8711 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
8712 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8713 int64_t ret_ref = 0;
8714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8717 ret_ref = (uintptr_t)ret_var.inner;
8718 if (ret_var.is_owned) {
8724 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8725 CHECK(owner->result_ok);
8726 return *owner->contents.result;
8728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8729 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8730 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8734 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8735 CHECK(!owner->result_ok);
8736 return PeerHandleError_clone(&*owner->contents.err);
8738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8739 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
8740 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8741 int64_t ret_ref = 0;
8742 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8743 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8745 ret_ref = (uintptr_t)ret_var.inner;
8746 if (ret_var.is_owned) {
8752 static jclass LDKGraphSyncError_DecodeError_class = NULL;
8753 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
8754 static jclass LDKGraphSyncError_LightningError_class = NULL;
8755 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
8756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
8757 LDKGraphSyncError_DecodeError_class =
8758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
8759 CHECK(LDKGraphSyncError_DecodeError_class != NULL);
8760 LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
8761 CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
8762 LDKGraphSyncError_LightningError_class =
8763 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
8764 CHECK(LDKGraphSyncError_LightningError_class != NULL);
8765 LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
8766 CHECK(LDKGraphSyncError_LightningError_meth != NULL);
8768 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8769 LDKGraphSyncError *obj = (LDKGraphSyncError*)(ptr & ~1);
8771 case LDKGraphSyncError_DecodeError: {
8772 LDKDecodeError decode_error_var = obj->decode_error;
8773 int64_t decode_error_ref = 0;
8774 CHECK((((uintptr_t)decode_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8775 CHECK((((uintptr_t)&decode_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8776 CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
8777 decode_error_ref = (uintptr_t)decode_error_var.inner & ~1;
8778 return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
8780 case LDKGraphSyncError_LightningError: {
8781 LDKLightningError lightning_error_var = obj->lightning_error;
8782 int64_t lightning_error_ref = 0;
8783 CHECK((((uintptr_t)lightning_error_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8784 CHECK((((uintptr_t)&lightning_error_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8785 CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8786 lightning_error_ref = (uintptr_t)lightning_error_var.inner & ~1;
8787 return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
8792 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8793 CHECK(owner->result_ok);
8794 return *owner->contents.result;
8796 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8797 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8798 int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8802 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8803 CHECK(!owner->result_ok);
8804 return GraphSyncError_clone(&*owner->contents.err);
8806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8807 LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)(owner & ~1);
8808 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8809 *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8810 int64_t ret_ref = (uintptr_t)ret_copy;
8814 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8815 CHECK(owner->result_ok);
8816 return NetAddress_clone(&*owner->contents.result);
8818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8819 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8820 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8821 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8822 int64_t ret_ref = (uintptr_t)ret_copy;
8826 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8827 CHECK(!owner->result_ok);
8828 return DecodeError_clone(&*owner->contents.err);
8830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8831 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8832 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8833 int64_t ret_ref = 0;
8834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8837 ret_ref = (uintptr_t)ret_var.inner;
8838 if (ret_var.is_owned) {
8844 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8845 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8846 for (size_t i = 0; i < ret.datalen; i++) {
8847 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8851 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8852 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8853 for (size_t i = 0; i < ret.datalen; i++) {
8854 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8858 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8859 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8860 for (size_t i = 0; i < ret.datalen; i++) {
8861 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8865 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8866 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8867 for (size_t i = 0; i < ret.datalen; i++) {
8868 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8872 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8873 CHECK(owner->result_ok);
8874 return AcceptChannel_clone(&*owner->contents.result);
8876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8877 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8878 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8879 int64_t ret_ref = 0;
8880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8883 ret_ref = (uintptr_t)ret_var.inner;
8884 if (ret_var.is_owned) {
8890 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8891 CHECK(!owner->result_ok);
8892 return DecodeError_clone(&*owner->contents.err);
8894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8895 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8896 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8897 int64_t ret_ref = 0;
8898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8901 ret_ref = (uintptr_t)ret_var.inner;
8902 if (ret_var.is_owned) {
8908 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8909 CHECK(owner->result_ok);
8910 return AnnouncementSignatures_clone(&*owner->contents.result);
8912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8913 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8914 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8915 int64_t ret_ref = 0;
8916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8919 ret_ref = (uintptr_t)ret_var.inner;
8920 if (ret_var.is_owned) {
8926 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8927 CHECK(!owner->result_ok);
8928 return DecodeError_clone(&*owner->contents.err);
8930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8931 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8932 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8933 int64_t ret_ref = 0;
8934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8937 ret_ref = (uintptr_t)ret_var.inner;
8938 if (ret_var.is_owned) {
8944 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8945 CHECK(owner->result_ok);
8946 return ChannelReestablish_clone(&*owner->contents.result);
8948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8949 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8950 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8951 int64_t ret_ref = 0;
8952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8955 ret_ref = (uintptr_t)ret_var.inner;
8956 if (ret_var.is_owned) {
8962 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8963 CHECK(!owner->result_ok);
8964 return DecodeError_clone(&*owner->contents.err);
8966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8967 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8968 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8969 int64_t ret_ref = 0;
8970 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8971 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8973 ret_ref = (uintptr_t)ret_var.inner;
8974 if (ret_var.is_owned) {
8980 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8981 CHECK(owner->result_ok);
8982 return ClosingSigned_clone(&*owner->contents.result);
8984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8985 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8986 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8987 int64_t ret_ref = 0;
8988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8991 ret_ref = (uintptr_t)ret_var.inner;
8992 if (ret_var.is_owned) {
8998 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8999 CHECK(!owner->result_ok);
9000 return DecodeError_clone(&*owner->contents.err);
9002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9003 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
9004 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9005 int64_t ret_ref = 0;
9006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9009 ret_ref = (uintptr_t)ret_var.inner;
9010 if (ret_var.is_owned) {
9016 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9017 CHECK(owner->result_ok);
9018 return ClosingSignedFeeRange_clone(&*owner->contents.result);
9020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9021 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
9022 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9023 int64_t ret_ref = 0;
9024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9027 ret_ref = (uintptr_t)ret_var.inner;
9028 if (ret_var.is_owned) {
9034 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9035 CHECK(!owner->result_ok);
9036 return DecodeError_clone(&*owner->contents.err);
9038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9039 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
9040 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9041 int64_t ret_ref = 0;
9042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9045 ret_ref = (uintptr_t)ret_var.inner;
9046 if (ret_var.is_owned) {
9052 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9053 CHECK(owner->result_ok);
9054 return CommitmentSigned_clone(&*owner->contents.result);
9056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9057 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
9058 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9059 int64_t ret_ref = 0;
9060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9063 ret_ref = (uintptr_t)ret_var.inner;
9064 if (ret_var.is_owned) {
9070 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9071 CHECK(!owner->result_ok);
9072 return DecodeError_clone(&*owner->contents.err);
9074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9075 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
9076 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9077 int64_t ret_ref = 0;
9078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9081 ret_ref = (uintptr_t)ret_var.inner;
9082 if (ret_var.is_owned) {
9088 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9089 CHECK(owner->result_ok);
9090 return FundingCreated_clone(&*owner->contents.result);
9092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9093 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
9094 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9095 int64_t ret_ref = 0;
9096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9099 ret_ref = (uintptr_t)ret_var.inner;
9100 if (ret_var.is_owned) {
9106 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9107 CHECK(!owner->result_ok);
9108 return DecodeError_clone(&*owner->contents.err);
9110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9111 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
9112 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9113 int64_t ret_ref = 0;
9114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9117 ret_ref = (uintptr_t)ret_var.inner;
9118 if (ret_var.is_owned) {
9124 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9125 CHECK(owner->result_ok);
9126 return FundingSigned_clone(&*owner->contents.result);
9128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9129 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
9130 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9131 int64_t ret_ref = 0;
9132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9135 ret_ref = (uintptr_t)ret_var.inner;
9136 if (ret_var.is_owned) {
9142 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9143 CHECK(!owner->result_ok);
9144 return DecodeError_clone(&*owner->contents.err);
9146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9147 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
9148 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9149 int64_t ret_ref = 0;
9150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9153 ret_ref = (uintptr_t)ret_var.inner;
9154 if (ret_var.is_owned) {
9160 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9161 CHECK(owner->result_ok);
9162 return ChannelReady_clone(&*owner->contents.result);
9164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9165 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
9166 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9167 int64_t ret_ref = 0;
9168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9171 ret_ref = (uintptr_t)ret_var.inner;
9172 if (ret_var.is_owned) {
9178 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9179 CHECK(!owner->result_ok);
9180 return DecodeError_clone(&*owner->contents.err);
9182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9183 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
9184 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9185 int64_t ret_ref = 0;
9186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9189 ret_ref = (uintptr_t)ret_var.inner;
9190 if (ret_var.is_owned) {
9196 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9197 CHECK(owner->result_ok);
9198 return Init_clone(&*owner->contents.result);
9200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9201 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
9202 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9203 int64_t ret_ref = 0;
9204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9207 ret_ref = (uintptr_t)ret_var.inner;
9208 if (ret_var.is_owned) {
9214 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9215 CHECK(!owner->result_ok);
9216 return DecodeError_clone(&*owner->contents.err);
9218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9219 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
9220 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
9221 int64_t ret_ref = 0;
9222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9225 ret_ref = (uintptr_t)ret_var.inner;
9226 if (ret_var.is_owned) {
9232 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9233 CHECK(owner->result_ok);
9234 return OpenChannel_clone(&*owner->contents.result);
9236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9237 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
9238 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9239 int64_t ret_ref = 0;
9240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9243 ret_ref = (uintptr_t)ret_var.inner;
9244 if (ret_var.is_owned) {
9250 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9251 CHECK(!owner->result_ok);
9252 return DecodeError_clone(&*owner->contents.err);
9254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9255 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
9256 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9257 int64_t ret_ref = 0;
9258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9261 ret_ref = (uintptr_t)ret_var.inner;
9262 if (ret_var.is_owned) {
9268 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9269 CHECK(owner->result_ok);
9270 return RevokeAndACK_clone(&*owner->contents.result);
9272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9273 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
9274 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9275 int64_t ret_ref = 0;
9276 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9277 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9279 ret_ref = (uintptr_t)ret_var.inner;
9280 if (ret_var.is_owned) {
9286 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9287 CHECK(!owner->result_ok);
9288 return DecodeError_clone(&*owner->contents.err);
9290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9291 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
9292 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9293 int64_t ret_ref = 0;
9294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9297 ret_ref = (uintptr_t)ret_var.inner;
9298 if (ret_var.is_owned) {
9304 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9305 CHECK(owner->result_ok);
9306 return Shutdown_clone(&*owner->contents.result);
9308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9309 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9310 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9311 int64_t ret_ref = 0;
9312 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9313 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9315 ret_ref = (uintptr_t)ret_var.inner;
9316 if (ret_var.is_owned) {
9322 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9323 CHECK(!owner->result_ok);
9324 return DecodeError_clone(&*owner->contents.err);
9326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9327 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
9328 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9329 int64_t ret_ref = 0;
9330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9333 ret_ref = (uintptr_t)ret_var.inner;
9334 if (ret_var.is_owned) {
9340 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9341 CHECK(owner->result_ok);
9342 return UpdateFailHTLC_clone(&*owner->contents.result);
9344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9345 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9346 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9347 int64_t ret_ref = 0;
9348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9351 ret_ref = (uintptr_t)ret_var.inner;
9352 if (ret_var.is_owned) {
9358 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9359 CHECK(!owner->result_ok);
9360 return DecodeError_clone(&*owner->contents.err);
9362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9363 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
9364 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9365 int64_t ret_ref = 0;
9366 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9367 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9369 ret_ref = (uintptr_t)ret_var.inner;
9370 if (ret_var.is_owned) {
9376 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9377 CHECK(owner->result_ok);
9378 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
9380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9381 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9382 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9383 int64_t ret_ref = 0;
9384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9387 ret_ref = (uintptr_t)ret_var.inner;
9388 if (ret_var.is_owned) {
9394 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9395 CHECK(!owner->result_ok);
9396 return DecodeError_clone(&*owner->contents.err);
9398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9399 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9400 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9401 int64_t ret_ref = 0;
9402 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9403 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9405 ret_ref = (uintptr_t)ret_var.inner;
9406 if (ret_var.is_owned) {
9412 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9413 CHECK(owner->result_ok);
9414 return UpdateFee_clone(&*owner->contents.result);
9416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9417 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9418 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9419 int64_t ret_ref = 0;
9420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9423 ret_ref = (uintptr_t)ret_var.inner;
9424 if (ret_var.is_owned) {
9430 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9431 CHECK(!owner->result_ok);
9432 return DecodeError_clone(&*owner->contents.err);
9434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9435 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9436 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9437 int64_t ret_ref = 0;
9438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9441 ret_ref = (uintptr_t)ret_var.inner;
9442 if (ret_var.is_owned) {
9448 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9449 CHECK(owner->result_ok);
9450 return UpdateFulfillHTLC_clone(&*owner->contents.result);
9452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9453 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9454 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9455 int64_t ret_ref = 0;
9456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9459 ret_ref = (uintptr_t)ret_var.inner;
9460 if (ret_var.is_owned) {
9466 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9467 CHECK(!owner->result_ok);
9468 return DecodeError_clone(&*owner->contents.err);
9470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9471 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9472 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9473 int64_t ret_ref = 0;
9474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9477 ret_ref = (uintptr_t)ret_var.inner;
9478 if (ret_var.is_owned) {
9484 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9485 CHECK(owner->result_ok);
9486 return UpdateAddHTLC_clone(&*owner->contents.result);
9488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9489 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9490 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9491 int64_t ret_ref = 0;
9492 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9493 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9495 ret_ref = (uintptr_t)ret_var.inner;
9496 if (ret_var.is_owned) {
9502 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9503 CHECK(!owner->result_ok);
9504 return DecodeError_clone(&*owner->contents.err);
9506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9507 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9508 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9509 int64_t ret_ref = 0;
9510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9513 ret_ref = (uintptr_t)ret_var.inner;
9514 if (ret_var.is_owned) {
9520 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9521 CHECK(owner->result_ok);
9522 return Ping_clone(&*owner->contents.result);
9524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9525 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9526 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9527 int64_t ret_ref = 0;
9528 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9529 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9531 ret_ref = (uintptr_t)ret_var.inner;
9532 if (ret_var.is_owned) {
9538 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9539 CHECK(!owner->result_ok);
9540 return DecodeError_clone(&*owner->contents.err);
9542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9543 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9544 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
9545 int64_t ret_ref = 0;
9546 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9547 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9549 ret_ref = (uintptr_t)ret_var.inner;
9550 if (ret_var.is_owned) {
9556 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9557 CHECK(owner->result_ok);
9558 return Pong_clone(&*owner->contents.result);
9560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9561 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9562 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9563 int64_t ret_ref = 0;
9564 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9565 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9567 ret_ref = (uintptr_t)ret_var.inner;
9568 if (ret_var.is_owned) {
9574 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9575 CHECK(!owner->result_ok);
9576 return DecodeError_clone(&*owner->contents.err);
9578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9579 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9580 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
9581 int64_t ret_ref = 0;
9582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9585 ret_ref = (uintptr_t)ret_var.inner;
9586 if (ret_var.is_owned) {
9592 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9593 CHECK(owner->result_ok);
9594 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
9596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9597 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9598 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9599 int64_t ret_ref = 0;
9600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9603 ret_ref = (uintptr_t)ret_var.inner;
9604 if (ret_var.is_owned) {
9610 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9611 CHECK(!owner->result_ok);
9612 return DecodeError_clone(&*owner->contents.err);
9614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9615 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9616 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9617 int64_t ret_ref = 0;
9618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9621 ret_ref = (uintptr_t)ret_var.inner;
9622 if (ret_var.is_owned) {
9628 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9629 CHECK(owner->result_ok);
9630 return ChannelAnnouncement_clone(&*owner->contents.result);
9632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9633 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9634 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9635 int64_t ret_ref = 0;
9636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9639 ret_ref = (uintptr_t)ret_var.inner;
9640 if (ret_var.is_owned) {
9646 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9647 CHECK(!owner->result_ok);
9648 return DecodeError_clone(&*owner->contents.err);
9650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9651 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9652 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9653 int64_t ret_ref = 0;
9654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9657 ret_ref = (uintptr_t)ret_var.inner;
9658 if (ret_var.is_owned) {
9664 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9665 CHECK(owner->result_ok);
9666 return UnsignedChannelUpdate_clone(&*owner->contents.result);
9668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9669 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9670 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9671 int64_t ret_ref = 0;
9672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9675 ret_ref = (uintptr_t)ret_var.inner;
9676 if (ret_var.is_owned) {
9682 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9683 CHECK(!owner->result_ok);
9684 return DecodeError_clone(&*owner->contents.err);
9686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9687 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9688 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9689 int64_t ret_ref = 0;
9690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9693 ret_ref = (uintptr_t)ret_var.inner;
9694 if (ret_var.is_owned) {
9700 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9701 CHECK(owner->result_ok);
9702 return ChannelUpdate_clone(&*owner->contents.result);
9704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9705 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9706 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9707 int64_t ret_ref = 0;
9708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9711 ret_ref = (uintptr_t)ret_var.inner;
9712 if (ret_var.is_owned) {
9718 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9719 CHECK(!owner->result_ok);
9720 return DecodeError_clone(&*owner->contents.err);
9722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9723 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9724 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9725 int64_t ret_ref = 0;
9726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9729 ret_ref = (uintptr_t)ret_var.inner;
9730 if (ret_var.is_owned) {
9736 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9737 CHECK(owner->result_ok);
9738 return ErrorMessage_clone(&*owner->contents.result);
9740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9741 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9742 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9743 int64_t ret_ref = 0;
9744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9747 ret_ref = (uintptr_t)ret_var.inner;
9748 if (ret_var.is_owned) {
9754 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9755 CHECK(!owner->result_ok);
9756 return DecodeError_clone(&*owner->contents.err);
9758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9759 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9760 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9761 int64_t ret_ref = 0;
9762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9765 ret_ref = (uintptr_t)ret_var.inner;
9766 if (ret_var.is_owned) {
9772 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9773 CHECK(owner->result_ok);
9774 return WarningMessage_clone(&*owner->contents.result);
9776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9777 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9778 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9779 int64_t ret_ref = 0;
9780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9783 ret_ref = (uintptr_t)ret_var.inner;
9784 if (ret_var.is_owned) {
9790 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9791 CHECK(!owner->result_ok);
9792 return DecodeError_clone(&*owner->contents.err);
9794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9795 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9796 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9797 int64_t ret_ref = 0;
9798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9801 ret_ref = (uintptr_t)ret_var.inner;
9802 if (ret_var.is_owned) {
9808 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9809 CHECK(owner->result_ok);
9810 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9813 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9814 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9815 int64_t ret_ref = 0;
9816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9819 ret_ref = (uintptr_t)ret_var.inner;
9820 if (ret_var.is_owned) {
9826 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9827 CHECK(!owner->result_ok);
9828 return DecodeError_clone(&*owner->contents.err);
9830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9831 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9832 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9833 int64_t ret_ref = 0;
9834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9837 ret_ref = (uintptr_t)ret_var.inner;
9838 if (ret_var.is_owned) {
9844 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9845 CHECK(owner->result_ok);
9846 return NodeAnnouncement_clone(&*owner->contents.result);
9848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9849 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9850 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9851 int64_t ret_ref = 0;
9852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9855 ret_ref = (uintptr_t)ret_var.inner;
9856 if (ret_var.is_owned) {
9862 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9863 CHECK(!owner->result_ok);
9864 return DecodeError_clone(&*owner->contents.err);
9866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9867 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9868 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9869 int64_t ret_ref = 0;
9870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9873 ret_ref = (uintptr_t)ret_var.inner;
9874 if (ret_var.is_owned) {
9880 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9881 CHECK(owner->result_ok);
9882 return QueryShortChannelIds_clone(&*owner->contents.result);
9884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9885 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9886 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9887 int64_t ret_ref = 0;
9888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9891 ret_ref = (uintptr_t)ret_var.inner;
9892 if (ret_var.is_owned) {
9898 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9899 CHECK(!owner->result_ok);
9900 return DecodeError_clone(&*owner->contents.err);
9902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9903 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9904 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9905 int64_t ret_ref = 0;
9906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9909 ret_ref = (uintptr_t)ret_var.inner;
9910 if (ret_var.is_owned) {
9916 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9917 CHECK(owner->result_ok);
9918 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9921 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9922 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9923 int64_t ret_ref = 0;
9924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9927 ret_ref = (uintptr_t)ret_var.inner;
9928 if (ret_var.is_owned) {
9934 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9935 CHECK(!owner->result_ok);
9936 return DecodeError_clone(&*owner->contents.err);
9938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9939 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9940 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9941 int64_t ret_ref = 0;
9942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9945 ret_ref = (uintptr_t)ret_var.inner;
9946 if (ret_var.is_owned) {
9952 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9953 CHECK(owner->result_ok);
9954 return QueryChannelRange_clone(&*owner->contents.result);
9956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9957 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9958 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9959 int64_t ret_ref = 0;
9960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9963 ret_ref = (uintptr_t)ret_var.inner;
9964 if (ret_var.is_owned) {
9970 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9971 CHECK(!owner->result_ok);
9972 return DecodeError_clone(&*owner->contents.err);
9974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9975 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9976 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9977 int64_t ret_ref = 0;
9978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9981 ret_ref = (uintptr_t)ret_var.inner;
9982 if (ret_var.is_owned) {
9988 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9989 CHECK(owner->result_ok);
9990 return ReplyChannelRange_clone(&*owner->contents.result);
9992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9993 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9994 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9995 int64_t ret_ref = 0;
9996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9999 ret_ref = (uintptr_t)ret_var.inner;
10000 if (ret_var.is_owned) {
10006 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10007 CHECK(!owner->result_ok);
10008 return DecodeError_clone(&*owner->contents.err);
10010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10011 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
10012 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10013 int64_t ret_ref = 0;
10014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10017 ret_ref = (uintptr_t)ret_var.inner;
10018 if (ret_var.is_owned) {
10024 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10025 CHECK(owner->result_ok);
10026 return GossipTimestampFilter_clone(&*owner->contents.result);
10028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10029 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
10030 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10031 int64_t ret_ref = 0;
10032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10035 ret_ref = (uintptr_t)ret_var.inner;
10036 if (ret_var.is_owned) {
10042 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10043 CHECK(!owner->result_ok);
10044 return DecodeError_clone(&*owner->contents.err);
10046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10047 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
10048 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10049 int64_t ret_ref = 0;
10050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10053 ret_ref = (uintptr_t)ret_var.inner;
10054 if (ret_var.is_owned) {
10060 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10061 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10062 for (size_t i = 0; i < ret.datalen; i++) {
10063 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10067 static jclass LDKSignOrCreationError_SignError_class = NULL;
10068 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
10069 static jclass LDKSignOrCreationError_CreationError_class = NULL;
10070 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
10071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
10072 LDKSignOrCreationError_SignError_class =
10073 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
10074 CHECK(LDKSignOrCreationError_SignError_class != NULL);
10075 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
10076 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
10077 LDKSignOrCreationError_CreationError_class =
10078 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
10079 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
10080 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
10081 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
10083 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10084 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
10086 case LDKSignOrCreationError_SignError: {
10087 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
10089 case LDKSignOrCreationError_CreationError: {
10090 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
10091 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
10096 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10097 CHECK(owner->result_ok);
10098 return Invoice_clone(&*owner->contents.result);
10100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10101 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
10102 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10103 int64_t ret_ref = 0;
10104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10107 ret_ref = (uintptr_t)ret_var.inner;
10108 if (ret_var.is_owned) {
10114 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10115 CHECK(!owner->result_ok);
10116 return SignOrCreationError_clone(&*owner->contents.err);
10118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10119 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
10120 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10121 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10122 int64_t ret_ref = (uintptr_t)ret_copy;
10126 typedef struct LDKFilter_JCalls {
10127 atomic_size_t refcnt;
10130 jmethodID register_tx_meth;
10131 jmethodID register_output_meth;
10132 } LDKFilter_JCalls;
10133 static void LDKFilter_JCalls_free(void* this_arg) {
10134 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10135 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10137 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10138 if (get_jenv_res == JNI_EDETACHED) {
10139 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10141 DO_ASSERT(get_jenv_res == JNI_OK);
10143 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10144 if (get_jenv_res == JNI_EDETACHED) {
10145 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10150 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
10151 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10153 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10154 if (get_jenv_res == JNI_EDETACHED) {
10155 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10157 DO_ASSERT(get_jenv_res == JNI_OK);
10159 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10160 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10161 LDKu8slice script_pubkey_var = script_pubkey;
10162 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
10163 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
10164 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10165 CHECK(obj != NULL);
10166 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
10167 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10168 (*env)->ExceptionDescribe(env);
10169 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
10171 if (get_jenv_res == JNI_EDETACHED) {
10172 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10175 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
10176 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10178 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10179 if (get_jenv_res == JNI_EDETACHED) {
10180 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10182 DO_ASSERT(get_jenv_res == JNI_OK);
10184 LDKWatchedOutput output_var = output;
10185 int64_t output_ref = 0;
10186 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10187 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10188 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
10189 output_ref = (uintptr_t)output_var.inner;
10190 if (output_var.is_owned) {
10193 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10194 CHECK(obj != NULL);
10195 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
10196 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10197 (*env)->ExceptionDescribe(env);
10198 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
10200 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10201 CHECK_ACCESS(ret_ptr);
10202 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
10204 if (get_jenv_res == JNI_EDETACHED) {
10205 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10209 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
10210 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
10211 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10213 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
10214 jclass c = (*env)->GetObjectClass(env, o);
10216 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
10217 atomic_init(&calls->refcnt, 1);
10218 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10219 calls->o = (*env)->NewWeakGlobalRef(env, o);
10220 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
10221 CHECK(calls->register_tx_meth != NULL);
10222 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
10223 CHECK(calls->register_output_meth != NULL);
10226 .this_arg = (void*) calls,
10227 .register_tx = register_tx_LDKFilter_jcall,
10228 .register_output = register_output_LDKFilter_jcall,
10229 .free = LDKFilter_JCalls_free,
10233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
10234 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10235 *res_ptr = LDKFilter_init(env, clz, o);
10236 return (uint64_t)res_ptr;
10238 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) {
10239 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10240 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10241 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10242 unsigned char txid_arr[32];
10243 CHECK((*env)->GetArrayLength(env, txid) == 32);
10244 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10245 unsigned char (*txid_ref)[32] = &txid_arr;
10246 LDKu8slice script_pubkey_ref;
10247 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
10248 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
10249 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
10250 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
10253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
10254 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10255 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10256 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10257 LDKWatchedOutput output_conv;
10258 output_conv.inner = (void*)(output & (~1));
10259 output_conv.is_owned = (output & 1) || (output == 0);
10260 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
10261 output_conv = WatchedOutput_clone(&output_conv);
10262 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10263 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
10264 int64_t ret_ref = (uintptr_t)ret_copy;
10268 static jclass LDKCOption_FilterZ_Some_class = NULL;
10269 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
10270 static jclass LDKCOption_FilterZ_None_class = NULL;
10271 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
10272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
10273 LDKCOption_FilterZ_Some_class =
10274 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
10275 CHECK(LDKCOption_FilterZ_Some_class != NULL);
10276 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
10277 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
10278 LDKCOption_FilterZ_None_class =
10279 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
10280 CHECK(LDKCOption_FilterZ_None_class != NULL);
10281 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
10282 CHECK(LDKCOption_FilterZ_None_meth != NULL);
10284 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10285 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
10287 case LDKCOption_FilterZ_Some: {
10288 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
10289 *some_ret = obj->some;
10290 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
10291 if ((*some_ret).free == LDKFilter_JCalls_free) {
10292 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10293 LDKFilter_JCalls_cloned(&(*some_ret));
10295 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (int64_t)some_ret);
10297 case LDKCOption_FilterZ_None: {
10298 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
10303 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10304 CHECK(owner->result_ok);
10305 return &*owner->contents.result;
10307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10308 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10309 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
10310 int64_t ret_ref = 0;
10311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10314 ret_ref = (uintptr_t)ret_var.inner & ~1;
10318 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10319 CHECK(!owner->result_ok);
10320 return *owner->contents.err;
10322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10323 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
10324 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
10327 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
10328 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
10329 for (size_t i = 0; i < ret.datalen; i++) {
10330 ret.data[i] = OutPoint_clone(&orig->data[i]);
10334 typedef struct LDKMessageSendEventsProvider_JCalls {
10335 atomic_size_t refcnt;
10338 jmethodID get_and_clear_pending_msg_events_meth;
10339 } LDKMessageSendEventsProvider_JCalls;
10340 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
10341 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10342 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10344 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10345 if (get_jenv_res == JNI_EDETACHED) {
10346 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10348 DO_ASSERT(get_jenv_res == JNI_OK);
10350 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10351 if (get_jenv_res == JNI_EDETACHED) {
10352 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10357 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
10358 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10360 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10361 if (get_jenv_res == JNI_EDETACHED) {
10362 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10364 DO_ASSERT(get_jenv_res == JNI_OK);
10366 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10367 CHECK(obj != NULL);
10368 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
10369 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10370 (*env)->ExceptionDescribe(env);
10371 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
10373 LDKCVec_MessageSendEventZ ret_constr;
10374 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10375 if (ret_constr.datalen > 0)
10376 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10378 ret_constr.data = NULL;
10379 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
10380 for (size_t s = 0; s < ret_constr.datalen; s++) {
10381 int64_t ret_conv_18 = ret_vals[s];
10382 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
10383 CHECK_ACCESS(ret_conv_18_ptr);
10384 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
10385 FREE((void*)ret_conv_18);
10386 ret_constr.data[s] = ret_conv_18_conv;
10388 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
10389 if (get_jenv_res == JNI_EDETACHED) {
10390 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10394 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10395 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10396 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10398 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10399 jclass c = (*env)->GetObjectClass(env, o);
10401 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10402 atomic_init(&calls->refcnt, 1);
10403 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10404 calls->o = (*env)->NewWeakGlobalRef(env, o);
10405 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
10406 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
10408 LDKMessageSendEventsProvider ret = {
10409 .this_arg = (void*) calls,
10410 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10411 .free = LDKMessageSendEventsProvider_JCalls_free,
10415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10416 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10417 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
10418 return (uint64_t)res_ptr;
10420 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10421 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10422 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10423 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10424 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10425 int64_tArray ret_arr = NULL;
10426 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10427 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10428 for (size_t s = 0; s < ret_var.datalen; s++) {
10429 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10430 *ret_conv_18_copy = ret_var.data[s];
10431 int64_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
10432 ret_arr_ptr[s] = ret_conv_18_ref;
10434 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10435 FREE(ret_var.data);
10439 typedef struct LDKEventHandler_JCalls {
10440 atomic_size_t refcnt;
10443 jmethodID handle_event_meth;
10444 } LDKEventHandler_JCalls;
10445 static void LDKEventHandler_JCalls_free(void* this_arg) {
10446 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10447 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10449 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10450 if (get_jenv_res == JNI_EDETACHED) {
10451 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10453 DO_ASSERT(get_jenv_res == JNI_OK);
10455 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10456 if (get_jenv_res == JNI_EDETACHED) {
10457 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10462 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
10463 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10465 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10466 if (get_jenv_res == JNI_EDETACHED) {
10467 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10469 DO_ASSERT(get_jenv_res == JNI_OK);
10471 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
10472 *ret_event = Event_clone(event);
10473 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10474 CHECK(obj != NULL);
10475 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (int64_t)ret_event);
10476 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10477 (*env)->ExceptionDescribe(env);
10478 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
10480 if (get_jenv_res == JNI_EDETACHED) {
10481 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10484 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
10485 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
10486 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10488 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
10489 jclass c = (*env)->GetObjectClass(env, o);
10491 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
10492 atomic_init(&calls->refcnt, 1);
10493 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10494 calls->o = (*env)->NewWeakGlobalRef(env, o);
10495 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
10496 CHECK(calls->handle_event_meth != NULL);
10498 LDKEventHandler ret = {
10499 .this_arg = (void*) calls,
10500 .handle_event = handle_event_LDKEventHandler_jcall,
10501 .free = LDKEventHandler_JCalls_free,
10505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
10506 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10507 *res_ptr = LDKEventHandler_init(env, clz, o);
10508 return (uint64_t)res_ptr;
10510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
10511 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10512 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10513 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
10514 LDKEvent* event_conv = (LDKEvent*)event;
10515 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
10518 typedef struct LDKEventsProvider_JCalls {
10519 atomic_size_t refcnt;
10522 jmethodID process_pending_events_meth;
10523 } LDKEventsProvider_JCalls;
10524 static void LDKEventsProvider_JCalls_free(void* this_arg) {
10525 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10526 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10528 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10529 if (get_jenv_res == JNI_EDETACHED) {
10530 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10532 DO_ASSERT(get_jenv_res == JNI_OK);
10534 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10535 if (get_jenv_res == JNI_EDETACHED) {
10536 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10541 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
10542 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10544 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10545 if (get_jenv_res == JNI_EDETACHED) {
10546 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10548 DO_ASSERT(get_jenv_res == JNI_OK);
10550 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10551 *handler_ret = handler;
10552 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10553 CHECK(obj != NULL);
10554 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (int64_t)handler_ret);
10555 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10556 (*env)->ExceptionDescribe(env);
10557 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
10559 if (get_jenv_res == JNI_EDETACHED) {
10560 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10563 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
10564 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
10565 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10567 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10568 jclass c = (*env)->GetObjectClass(env, o);
10570 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
10571 atomic_init(&calls->refcnt, 1);
10572 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10573 calls->o = (*env)->NewWeakGlobalRef(env, o);
10574 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
10575 CHECK(calls->process_pending_events_meth != NULL);
10577 LDKEventsProvider ret = {
10578 .this_arg = (void*) calls,
10579 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
10580 .free = LDKEventsProvider_JCalls_free,
10584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10585 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10586 *res_ptr = LDKEventsProvider_init(env, clz, o);
10587 return (uint64_t)res_ptr;
10589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
10590 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10591 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10592 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
10593 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
10594 CHECK_ACCESS(handler_ptr);
10595 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
10596 if (handler_conv.free == LDKEventHandler_JCalls_free) {
10597 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10598 LDKEventHandler_JCalls_cloned(&handler_conv);
10600 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
10603 typedef struct LDKScore_JCalls {
10604 atomic_size_t refcnt;
10607 jmethodID channel_penalty_msat_meth;
10608 jmethodID payment_path_failed_meth;
10609 jmethodID payment_path_successful_meth;
10610 jmethodID probe_failed_meth;
10611 jmethodID probe_successful_meth;
10612 jmethodID write_meth;
10614 static void LDKScore_JCalls_free(void* this_arg) {
10615 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10616 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10618 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10619 if (get_jenv_res == JNI_EDETACHED) {
10620 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10622 DO_ASSERT(get_jenv_res == JNI_OK);
10624 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10625 if (get_jenv_res == JNI_EDETACHED) {
10626 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10631 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
10632 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10634 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10635 if (get_jenv_res == JNI_EDETACHED) {
10636 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10638 DO_ASSERT(get_jenv_res == JNI_OK);
10640 int64_t short_channel_id_conv = short_channel_id;
10641 LDKNodeId source_var = *source;
10642 int64_t source_ref = 0;
10643 source_var = NodeId_clone(&source_var);
10644 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10645 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10646 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
10647 source_ref = (uintptr_t)source_var.inner;
10648 if (source_var.is_owned) {
10651 LDKNodeId target_var = *target;
10652 int64_t target_ref = 0;
10653 target_var = NodeId_clone(&target_var);
10654 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10655 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10656 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
10657 target_ref = (uintptr_t)target_var.inner;
10658 if (target_var.is_owned) {
10661 LDKChannelUsage usage_var = usage;
10662 int64_t usage_ref = 0;
10663 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10664 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10665 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
10666 usage_ref = (uintptr_t)usage_var.inner;
10667 if (usage_var.is_owned) {
10670 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10671 CHECK(obj != NULL);
10672 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
10673 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10674 (*env)->ExceptionDescribe(env);
10675 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10677 if (get_jenv_res == JNI_EDETACHED) {
10678 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10682 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10683 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10685 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10686 if (get_jenv_res == JNI_EDETACHED) {
10687 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10689 DO_ASSERT(get_jenv_res == JNI_OK);
10691 LDKCVec_RouteHopZ path_var = path;
10692 int64_tArray path_arr = NULL;
10693 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10694 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10695 for (size_t k = 0; k < path_var.datalen; k++) {
10696 LDKRouteHop path_conv_10_var = path_var.data[k];
10697 int64_t path_conv_10_ref = 0;
10698 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10699 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10700 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10701 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10702 if (path_conv_10_var.is_owned) {
10703 path_conv_10_ref |= 1;
10705 path_arr_ptr[k] = path_conv_10_ref;
10707 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10708 FREE(path_var.data);
10709 int64_t short_channel_id_conv = short_channel_id;
10710 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10711 CHECK(obj != NULL);
10712 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
10713 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10714 (*env)->ExceptionDescribe(env);
10715 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
10717 if (get_jenv_res == JNI_EDETACHED) {
10718 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10721 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
10722 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10724 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10725 if (get_jenv_res == JNI_EDETACHED) {
10726 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10728 DO_ASSERT(get_jenv_res == JNI_OK);
10730 LDKCVec_RouteHopZ path_var = path;
10731 int64_tArray path_arr = NULL;
10732 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10733 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10734 for (size_t k = 0; k < path_var.datalen; k++) {
10735 LDKRouteHop path_conv_10_var = path_var.data[k];
10736 int64_t path_conv_10_ref = 0;
10737 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10738 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10739 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10740 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10741 if (path_conv_10_var.is_owned) {
10742 path_conv_10_ref |= 1;
10744 path_arr_ptr[k] = path_conv_10_ref;
10746 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10747 FREE(path_var.data);
10748 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10749 CHECK(obj != NULL);
10750 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
10751 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10752 (*env)->ExceptionDescribe(env);
10753 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
10755 if (get_jenv_res == JNI_EDETACHED) {
10756 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10759 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10760 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10762 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10763 if (get_jenv_res == JNI_EDETACHED) {
10764 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10766 DO_ASSERT(get_jenv_res == JNI_OK);
10768 LDKCVec_RouteHopZ path_var = path;
10769 int64_tArray path_arr = NULL;
10770 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10771 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10772 for (size_t k = 0; k < path_var.datalen; k++) {
10773 LDKRouteHop path_conv_10_var = path_var.data[k];
10774 int64_t path_conv_10_ref = 0;
10775 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10776 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10777 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10778 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10779 if (path_conv_10_var.is_owned) {
10780 path_conv_10_ref |= 1;
10782 path_arr_ptr[k] = path_conv_10_ref;
10784 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10785 FREE(path_var.data);
10786 int64_t short_channel_id_conv = short_channel_id;
10787 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10788 CHECK(obj != NULL);
10789 (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv);
10790 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10791 (*env)->ExceptionDescribe(env);
10792 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
10794 if (get_jenv_res == JNI_EDETACHED) {
10795 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10798 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
10799 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10801 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10802 if (get_jenv_res == JNI_EDETACHED) {
10803 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10805 DO_ASSERT(get_jenv_res == JNI_OK);
10807 LDKCVec_RouteHopZ path_var = path;
10808 int64_tArray path_arr = NULL;
10809 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10810 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10811 for (size_t k = 0; k < path_var.datalen; k++) {
10812 LDKRouteHop path_conv_10_var = path_var.data[k];
10813 int64_t path_conv_10_ref = 0;
10814 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10815 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10816 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10817 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
10818 if (path_conv_10_var.is_owned) {
10819 path_conv_10_ref |= 1;
10821 path_arr_ptr[k] = path_conv_10_ref;
10823 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10824 FREE(path_var.data);
10825 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10826 CHECK(obj != NULL);
10827 (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr);
10828 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10829 (*env)->ExceptionDescribe(env);
10830 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
10832 if (get_jenv_res == JNI_EDETACHED) {
10833 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10836 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10837 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10839 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10840 if (get_jenv_res == JNI_EDETACHED) {
10841 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10843 DO_ASSERT(get_jenv_res == JNI_OK);
10845 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10846 CHECK(obj != NULL);
10847 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10848 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10849 (*env)->ExceptionDescribe(env);
10850 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
10852 LDKCVec_u8Z ret_ref;
10853 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10854 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10855 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10856 if (get_jenv_res == JNI_EDETACHED) {
10857 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10861 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10862 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10863 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10865 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10866 jclass c = (*env)->GetObjectClass(env, o);
10868 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10869 atomic_init(&calls->refcnt, 1);
10870 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10871 calls->o = (*env)->NewWeakGlobalRef(env, o);
10872 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
10873 CHECK(calls->channel_penalty_msat_meth != NULL);
10874 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
10875 CHECK(calls->payment_path_failed_meth != NULL);
10876 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
10877 CHECK(calls->payment_path_successful_meth != NULL);
10878 calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V");
10879 CHECK(calls->probe_failed_meth != NULL);
10880 calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V");
10881 CHECK(calls->probe_successful_meth != NULL);
10882 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10883 CHECK(calls->write_meth != NULL);
10886 .this_arg = (void*) calls,
10887 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10888 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10889 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10890 .probe_failed = probe_failed_LDKScore_jcall,
10891 .probe_successful = probe_successful_LDKScore_jcall,
10892 .write = write_LDKScore_jcall,
10893 .free = LDKScore_JCalls_free,
10897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10898 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10899 *res_ptr = LDKScore_init(env, clz, o);
10900 return (uint64_t)res_ptr;
10902 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 source, int64_t target, int64_t usage) {
10903 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10904 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10905 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10906 LDKNodeId source_conv;
10907 source_conv.inner = (void*)(source & (~1));
10908 source_conv.is_owned = false;
10909 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10910 LDKNodeId target_conv;
10911 target_conv.inner = (void*)(target & (~1));
10912 target_conv.is_owned = false;
10913 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10914 LDKChannelUsage usage_conv;
10915 usage_conv.inner = (void*)(usage & (~1));
10916 usage_conv.is_owned = (usage & 1) || (usage == 0);
10917 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10918 usage_conv = ChannelUsage_clone(&usage_conv);
10919 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
10923 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) {
10924 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10925 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10926 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10927 LDKCVec_RouteHopZ path_constr;
10928 path_constr.datalen = (*env)->GetArrayLength(env, path);
10929 if (path_constr.datalen > 0)
10930 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10932 path_constr.data = NULL;
10933 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10934 for (size_t k = 0; k < path_constr.datalen; k++) {
10935 int64_t path_conv_10 = path_vals[k];
10936 LDKRouteHop path_conv_10_conv;
10937 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10938 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10939 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10940 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10941 path_constr.data[k] = path_conv_10_conv;
10943 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10944 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10948 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10949 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10950 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10951 LDKCVec_RouteHopZ path_constr;
10952 path_constr.datalen = (*env)->GetArrayLength(env, path);
10953 if (path_constr.datalen > 0)
10954 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10956 path_constr.data = NULL;
10957 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10958 for (size_t k = 0; k < path_constr.datalen; k++) {
10959 int64_t path_conv_10 = path_vals[k];
10960 LDKRouteHop path_conv_10_conv;
10961 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10962 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10963 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10964 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10965 path_constr.data[k] = path_conv_10_conv;
10967 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10968 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
10971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
10972 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10973 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10974 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10975 LDKCVec_RouteHopZ path_constr;
10976 path_constr.datalen = (*env)->GetArrayLength(env, path);
10977 if (path_constr.datalen > 0)
10978 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10980 path_constr.data = NULL;
10981 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10982 for (size_t k = 0; k < path_constr.datalen; k++) {
10983 int64_t path_conv_10 = path_vals[k];
10984 LDKRouteHop path_conv_10_conv;
10985 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10986 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10987 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10988 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10989 path_constr.data[k] = path_conv_10_conv;
10991 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10992 (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10996 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10997 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10998 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10999 LDKCVec_RouteHopZ path_constr;
11000 path_constr.datalen = (*env)->GetArrayLength(env, path);
11001 if (path_constr.datalen > 0)
11002 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11004 path_constr.data = NULL;
11005 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
11006 for (size_t k = 0; k < path_constr.datalen; k++) {
11007 int64_t path_conv_10 = path_vals[k];
11008 LDKRouteHop path_conv_10_conv;
11009 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
11010 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
11011 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11012 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11013 path_constr.data[k] = path_conv_10_conv;
11015 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
11016 (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
11019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11020 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11021 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11022 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
11023 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11024 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11025 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11026 CVec_u8Z_free(ret_var);
11030 typedef struct LDKPersister_JCalls {
11031 atomic_size_t refcnt;
11034 jmethodID persist_manager_meth;
11035 jmethodID persist_graph_meth;
11036 jmethodID persist_scorer_meth;
11037 } LDKPersister_JCalls;
11038 static void LDKPersister_JCalls_free(void* this_arg) {
11039 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11040 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11049 if (get_jenv_res == JNI_EDETACHED) {
11050 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11055 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
11056 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11058 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11059 if (get_jenv_res == JNI_EDETACHED) {
11060 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11062 DO_ASSERT(get_jenv_res == JNI_OK);
11064 LDKChannelManager channel_manager_var = *channel_manager;
11065 int64_t channel_manager_ref = 0;
11066 // WARNING: we may need a move here but no clone is available for LDKChannelManager
11067 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11068 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11069 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
11070 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
11071 if (channel_manager_var.is_owned) {
11072 channel_manager_ref |= 1;
11074 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11075 CHECK(obj != NULL);
11076 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
11077 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11078 (*env)->ExceptionDescribe(env);
11079 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
11081 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11082 CHECK_ACCESS(ret_ptr);
11083 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
11085 if (get_jenv_res == JNI_EDETACHED) {
11086 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11090 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
11091 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11093 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11094 if (get_jenv_res == JNI_EDETACHED) {
11095 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11097 DO_ASSERT(get_jenv_res == JNI_OK);
11099 LDKNetworkGraph network_graph_var = *network_graph;
11100 int64_t network_graph_ref = 0;
11101 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
11102 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11103 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11104 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
11105 network_graph_ref = (uintptr_t)network_graph_var.inner;
11106 if (network_graph_var.is_owned) {
11107 network_graph_ref |= 1;
11109 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11110 CHECK(obj != NULL);
11111 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
11112 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11113 (*env)->ExceptionDescribe(env);
11114 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
11116 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11117 CHECK_ACCESS(ret_ptr);
11118 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
11120 if (get_jenv_res == JNI_EDETACHED) {
11121 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11125 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
11126 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11128 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11129 if (get_jenv_res == JNI_EDETACHED) {
11130 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11132 DO_ASSERT(get_jenv_res == JNI_OK);
11134 LDKMultiThreadedLockableScore scorer_var = *scorer;
11135 int64_t scorer_ref = 0;
11136 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
11137 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11138 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11139 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
11140 scorer_ref = (uintptr_t)scorer_var.inner;
11141 if (scorer_var.is_owned) {
11144 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11145 CHECK(obj != NULL);
11146 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, scorer_ref);
11147 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11148 (*env)->ExceptionDescribe(env);
11149 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
11151 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11152 CHECK_ACCESS(ret_ptr);
11153 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
11155 if (get_jenv_res == JNI_EDETACHED) {
11156 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11160 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
11161 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
11162 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11164 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
11165 jclass c = (*env)->GetObjectClass(env, o);
11167 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
11168 atomic_init(&calls->refcnt, 1);
11169 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11170 calls->o = (*env)->NewWeakGlobalRef(env, o);
11171 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
11172 CHECK(calls->persist_manager_meth != NULL);
11173 calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
11174 CHECK(calls->persist_graph_meth != NULL);
11175 calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
11176 CHECK(calls->persist_scorer_meth != NULL);
11178 LDKPersister ret = {
11179 .this_arg = (void*) calls,
11180 .persist_manager = persist_manager_LDKPersister_jcall,
11181 .persist_graph = persist_graph_LDKPersister_jcall,
11182 .persist_scorer = persist_scorer_LDKPersister_jcall,
11183 .free = LDKPersister_JCalls_free,
11187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
11188 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
11189 *res_ptr = LDKPersister_init(env, clz, o);
11190 return (uint64_t)res_ptr;
11192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
11193 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11194 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11195 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11196 LDKChannelManager channel_manager_conv;
11197 channel_manager_conv.inner = (void*)(channel_manager & (~1));
11198 channel_manager_conv.is_owned = false;
11199 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
11200 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11201 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
11202 return (int64_t)ret_conv;
11205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
11206 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11207 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11208 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11209 LDKNetworkGraph network_graph_conv;
11210 network_graph_conv.inner = (void*)(network_graph & (~1));
11211 network_graph_conv.is_owned = false;
11212 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
11213 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11214 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
11215 return (int64_t)ret_conv;
11218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
11219 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11220 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11221 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11222 LDKMultiThreadedLockableScore scorer_conv;
11223 scorer_conv.inner = (void*)(scorer & (~1));
11224 scorer_conv.is_owned = false;
11225 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
11226 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11227 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
11228 return (int64_t)ret_conv;
11231 typedef struct LDKListen_JCalls {
11232 atomic_size_t refcnt;
11235 jmethodID filtered_block_connected_meth;
11236 jmethodID block_connected_meth;
11237 jmethodID block_disconnected_meth;
11238 } LDKListen_JCalls;
11239 static void LDKListen_JCalls_free(void* this_arg) {
11240 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11241 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11243 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11244 if (get_jenv_res == JNI_EDETACHED) {
11245 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11247 DO_ASSERT(get_jenv_res == JNI_OK);
11249 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11250 if (get_jenv_res == JNI_EDETACHED) {
11251 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11256 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11257 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11259 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11260 if (get_jenv_res == JNI_EDETACHED) {
11261 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11263 DO_ASSERT(get_jenv_res == JNI_OK);
11265 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11266 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11267 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11268 int64_tArray txdata_arr = NULL;
11269 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11270 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11271 for (size_t c = 0; c < txdata_var.datalen; c++) {
11272 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11273 *txdata_conv_28_conv = txdata_var.data[c];
11274 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
11276 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11277 FREE(txdata_var.data);
11278 int32_t height_conv = height;
11279 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11280 CHECK(obj != NULL);
11281 (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
11282 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11283 (*env)->ExceptionDescribe(env);
11284 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
11286 if (get_jenv_res == JNI_EDETACHED) {
11287 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11290 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
11291 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11293 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11294 if (get_jenv_res == JNI_EDETACHED) {
11295 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11297 DO_ASSERT(get_jenv_res == JNI_OK);
11299 LDKu8slice block_var = block;
11300 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
11301 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
11302 int32_t height_conv = height;
11303 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11304 CHECK(obj != NULL);
11305 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
11306 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11307 (*env)->ExceptionDescribe(env);
11308 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
11310 if (get_jenv_res == JNI_EDETACHED) {
11311 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11314 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11315 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11317 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11318 if (get_jenv_res == JNI_EDETACHED) {
11319 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11321 DO_ASSERT(get_jenv_res == JNI_OK);
11323 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11324 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11325 int32_t height_conv = height;
11326 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11327 CHECK(obj != NULL);
11328 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
11329 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11330 (*env)->ExceptionDescribe(env);
11331 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
11333 if (get_jenv_res == JNI_EDETACHED) {
11334 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11337 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11338 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11339 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11341 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
11342 jclass c = (*env)->GetObjectClass(env, o);
11344 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
11345 atomic_init(&calls->refcnt, 1);
11346 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11347 calls->o = (*env)->NewWeakGlobalRef(env, o);
11348 calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
11349 CHECK(calls->filtered_block_connected_meth != NULL);
11350 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
11351 CHECK(calls->block_connected_meth != NULL);
11352 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
11353 CHECK(calls->block_disconnected_meth != NULL);
11356 .this_arg = (void*) calls,
11357 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
11358 .block_connected = block_connected_LDKListen_jcall,
11359 .block_disconnected = block_disconnected_LDKListen_jcall,
11360 .free = LDKListen_JCalls_free,
11364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
11365 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
11366 *res_ptr = LDKListen_init(env, clz, o);
11367 return (uint64_t)res_ptr;
11369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1filtered_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
11370 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11371 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11372 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11373 unsigned char header_arr[80];
11374 CHECK((*env)->GetArrayLength(env, header) == 80);
11375 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11376 unsigned char (*header_ref)[80] = &header_arr;
11377 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11378 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11379 if (txdata_constr.datalen > 0)
11380 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11382 txdata_constr.data = NULL;
11383 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11384 for (size_t c = 0; c < txdata_constr.datalen; c++) {
11385 int64_t txdata_conv_28 = txdata_vals[c];
11386 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
11387 CHECK_ACCESS(txdata_conv_28_ptr);
11388 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11389 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
11390 txdata_constr.data[c] = txdata_conv_28_conv;
11392 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11393 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11396 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) {
11397 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11398 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11399 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11400 LDKu8slice block_ref;
11401 block_ref.datalen = (*env)->GetArrayLength(env, block);
11402 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
11403 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
11404 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
11407 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) {
11408 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11409 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11410 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11411 unsigned char header_arr[80];
11412 CHECK((*env)->GetArrayLength(env, header) == 80);
11413 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11414 unsigned char (*header_ref)[80] = &header_arr;
11415 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
11418 typedef struct LDKConfirm_JCalls {
11419 atomic_size_t refcnt;
11422 jmethodID transactions_confirmed_meth;
11423 jmethodID transaction_unconfirmed_meth;
11424 jmethodID best_block_updated_meth;
11425 jmethodID get_relevant_txids_meth;
11426 } LDKConfirm_JCalls;
11427 static void LDKConfirm_JCalls_free(void* this_arg) {
11428 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11429 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11431 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11432 if (get_jenv_res == JNI_EDETACHED) {
11433 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11435 DO_ASSERT(get_jenv_res == JNI_OK);
11437 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11438 if (get_jenv_res == JNI_EDETACHED) {
11439 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11444 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11445 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11447 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11448 if (get_jenv_res == JNI_EDETACHED) {
11449 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11451 DO_ASSERT(get_jenv_res == JNI_OK);
11453 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11454 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11455 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11456 int64_tArray txdata_arr = NULL;
11457 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11458 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11459 for (size_t c = 0; c < txdata_var.datalen; c++) {
11460 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11461 *txdata_conv_28_conv = txdata_var.data[c];
11462 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
11464 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11465 FREE(txdata_var.data);
11466 int32_t height_conv = height;
11467 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11468 CHECK(obj != NULL);
11469 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
11470 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11471 (*env)->ExceptionDescribe(env);
11472 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
11474 if (get_jenv_res == JNI_EDETACHED) {
11475 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11478 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
11479 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11481 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11482 if (get_jenv_res == JNI_EDETACHED) {
11483 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11485 DO_ASSERT(get_jenv_res == JNI_OK);
11487 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
11488 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
11489 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11490 CHECK(obj != NULL);
11491 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
11492 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11493 (*env)->ExceptionDescribe(env);
11494 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
11496 if (get_jenv_res == JNI_EDETACHED) {
11497 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11500 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11501 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11503 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11504 if (get_jenv_res == JNI_EDETACHED) {
11505 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11507 DO_ASSERT(get_jenv_res == JNI_OK);
11509 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11510 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11511 int32_t height_conv = height;
11512 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11513 CHECK(obj != NULL);
11514 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
11515 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11516 (*env)->ExceptionDescribe(env);
11517 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
11519 if (get_jenv_res == JNI_EDETACHED) {
11520 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11523 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
11524 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11526 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11527 if (get_jenv_res == JNI_EDETACHED) {
11528 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11530 DO_ASSERT(get_jenv_res == JNI_OK);
11532 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11533 CHECK(obj != NULL);
11534 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
11535 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11536 (*env)->ExceptionDescribe(env);
11537 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
11539 LDKCVec_TxidZ ret_constr;
11540 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11541 if (ret_constr.datalen > 0)
11542 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11544 ret_constr.data = NULL;
11545 for (size_t i = 0; i < ret_constr.datalen; i++) {
11546 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
11547 LDKThirtyTwoBytes ret_conv_8_ref;
11548 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
11549 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
11550 ret_constr.data[i] = ret_conv_8_ref;
11552 if (get_jenv_res == JNI_EDETACHED) {
11553 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11557 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
11558 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
11559 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11561 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
11562 jclass c = (*env)->GetObjectClass(env, o);
11564 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
11565 atomic_init(&calls->refcnt, 1);
11566 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11567 calls->o = (*env)->NewWeakGlobalRef(env, o);
11568 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
11569 CHECK(calls->transactions_confirmed_meth != NULL);
11570 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
11571 CHECK(calls->transaction_unconfirmed_meth != NULL);
11572 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
11573 CHECK(calls->best_block_updated_meth != NULL);
11574 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
11575 CHECK(calls->get_relevant_txids_meth != NULL);
11578 .this_arg = (void*) calls,
11579 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
11580 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
11581 .best_block_updated = best_block_updated_LDKConfirm_jcall,
11582 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
11583 .free = LDKConfirm_JCalls_free,
11587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
11588 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
11589 *res_ptr = LDKConfirm_init(env, clz, o);
11590 return (uint64_t)res_ptr;
11592 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) {
11593 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11594 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11595 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11596 unsigned char header_arr[80];
11597 CHECK((*env)->GetArrayLength(env, header) == 80);
11598 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11599 unsigned char (*header_ref)[80] = &header_arr;
11600 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11601 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11602 if (txdata_constr.datalen > 0)
11603 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11605 txdata_constr.data = NULL;
11606 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11607 for (size_t c = 0; c < txdata_constr.datalen; c++) {
11608 int64_t txdata_conv_28 = txdata_vals[c];
11609 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
11610 CHECK_ACCESS(txdata_conv_28_ptr);
11611 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11612 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
11613 txdata_constr.data[c] = txdata_conv_28_conv;
11615 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11616 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
11620 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11621 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11622 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11623 unsigned char txid_arr[32];
11624 CHECK((*env)->GetArrayLength(env, txid) == 32);
11625 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
11626 unsigned char (*txid_ref)[32] = &txid_arr;
11627 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
11630 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) {
11631 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11632 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11633 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11634 unsigned char header_arr[80];
11635 CHECK((*env)->GetArrayLength(env, header) == 80);
11636 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11637 unsigned char (*header_ref)[80] = &header_arr;
11638 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
11641 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
11642 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11643 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11644 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11645 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
11646 jobjectArray ret_arr = NULL;
11647 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11649 for (size_t i = 0; i < ret_var.datalen; i++) {
11650 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
11651 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
11652 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11655 FREE(ret_var.data);
11659 typedef struct LDKPersist_JCalls {
11660 atomic_size_t refcnt;
11663 jmethodID persist_new_channel_meth;
11664 jmethodID update_persisted_channel_meth;
11665 } LDKPersist_JCalls;
11666 static void LDKPersist_JCalls_free(void* this_arg) {
11667 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11668 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11670 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11671 if (get_jenv_res == JNI_EDETACHED) {
11672 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11674 DO_ASSERT(get_jenv_res == JNI_OK);
11676 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11677 if (get_jenv_res == JNI_EDETACHED) {
11678 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11683 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11684 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11686 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11687 if (get_jenv_res == JNI_EDETACHED) {
11688 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11690 DO_ASSERT(get_jenv_res == JNI_OK);
11692 LDKOutPoint channel_id_var = channel_id;
11693 int64_t channel_id_ref = 0;
11694 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11695 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11696 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11697 channel_id_ref = (uintptr_t)channel_id_var.inner;
11698 if (channel_id_var.is_owned) {
11699 channel_id_ref |= 1;
11701 LDKChannelMonitor data_var = *data;
11702 int64_t data_ref = 0;
11703 data_var = ChannelMonitor_clone(&data_var);
11704 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11705 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11706 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11707 data_ref = (uintptr_t)data_var.inner;
11708 if (data_var.is_owned) {
11711 LDKMonitorUpdateId update_id_var = update_id;
11712 int64_t update_id_ref = 0;
11713 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11714 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11715 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11716 update_id_ref = (uintptr_t)update_id_var.inner;
11717 if (update_id_var.is_owned) {
11718 update_id_ref |= 1;
11720 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11721 CHECK(obj != NULL);
11722 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
11723 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11724 (*env)->ExceptionDescribe(env);
11725 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
11727 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11728 CHECK_ACCESS(ret_ptr);
11729 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11731 if (get_jenv_res == JNI_EDETACHED) {
11732 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11736 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11737 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11739 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11740 if (get_jenv_res == JNI_EDETACHED) {
11741 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11743 DO_ASSERT(get_jenv_res == JNI_OK);
11745 LDKOutPoint channel_id_var = channel_id;
11746 int64_t channel_id_ref = 0;
11747 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11748 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11749 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11750 channel_id_ref = (uintptr_t)channel_id_var.inner;
11751 if (channel_id_var.is_owned) {
11752 channel_id_ref |= 1;
11754 LDKChannelMonitorUpdate update_var = *update;
11755 int64_t update_ref = 0;
11756 if ((uintptr_t)update_var.inner > 4096) {
11757 update_var = ChannelMonitorUpdate_clone(&update_var);
11758 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11759 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11760 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11761 update_ref = (uintptr_t)update_var.inner;
11762 if (update_var.is_owned) {
11766 LDKChannelMonitor data_var = *data;
11767 int64_t data_ref = 0;
11768 data_var = ChannelMonitor_clone(&data_var);
11769 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11770 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11771 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11772 data_ref = (uintptr_t)data_var.inner;
11773 if (data_var.is_owned) {
11776 LDKMonitorUpdateId update_id_var = update_id;
11777 int64_t update_id_ref = 0;
11778 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11779 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11780 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11781 update_id_ref = (uintptr_t)update_id_var.inner;
11782 if (update_id_var.is_owned) {
11783 update_id_ref |= 1;
11785 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11786 CHECK(obj != NULL);
11787 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
11788 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11789 (*env)->ExceptionDescribe(env);
11790 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
11792 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11793 CHECK_ACCESS(ret_ptr);
11794 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11796 if (get_jenv_res == JNI_EDETACHED) {
11797 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11801 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11802 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11803 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11805 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
11806 jclass c = (*env)->GetObjectClass(env, o);
11808 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11809 atomic_init(&calls->refcnt, 1);
11810 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11811 calls->o = (*env)->NewWeakGlobalRef(env, o);
11812 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
11813 CHECK(calls->persist_new_channel_meth != NULL);
11814 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
11815 CHECK(calls->update_persisted_channel_meth != NULL);
11818 .this_arg = (void*) calls,
11819 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11820 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11821 .free = LDKPersist_JCalls_free,
11825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
11826 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11827 *res_ptr = LDKPersist_init(env, clz, o);
11828 return (uint64_t)res_ptr;
11830 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) {
11831 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11832 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11833 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11834 LDKOutPoint channel_id_conv;
11835 channel_id_conv.inner = (void*)(channel_id & (~1));
11836 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11837 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11838 channel_id_conv = OutPoint_clone(&channel_id_conv);
11839 LDKChannelMonitor data_conv;
11840 data_conv.inner = (void*)(data & (~1));
11841 data_conv.is_owned = false;
11842 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11843 LDKMonitorUpdateId update_id_conv;
11844 update_id_conv.inner = (void*)(update_id & (~1));
11845 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11846 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11847 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11848 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11849 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
11850 return (int64_t)ret_conv;
11853 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) {
11854 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11855 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11856 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11857 LDKOutPoint channel_id_conv;
11858 channel_id_conv.inner = (void*)(channel_id & (~1));
11859 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
11860 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11861 channel_id_conv = OutPoint_clone(&channel_id_conv);
11862 LDKChannelMonitorUpdate update_conv;
11863 update_conv.inner = (void*)(update & (~1));
11864 update_conv.is_owned = false;
11865 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11866 LDKChannelMonitor data_conv;
11867 data_conv.inner = (void*)(data & (~1));
11868 data_conv.is_owned = false;
11869 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11870 LDKMonitorUpdateId update_id_conv;
11871 update_id_conv.inner = (void*)(update_id & (~1));
11872 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
11873 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11874 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11875 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11876 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
11877 return (int64_t)ret_conv;
11880 typedef struct LDKChannelMessageHandler_JCalls {
11881 atomic_size_t refcnt;
11884 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11885 jmethodID handle_open_channel_meth;
11886 jmethodID handle_accept_channel_meth;
11887 jmethodID handle_funding_created_meth;
11888 jmethodID handle_funding_signed_meth;
11889 jmethodID handle_channel_ready_meth;
11890 jmethodID handle_shutdown_meth;
11891 jmethodID handle_closing_signed_meth;
11892 jmethodID handle_update_add_htlc_meth;
11893 jmethodID handle_update_fulfill_htlc_meth;
11894 jmethodID handle_update_fail_htlc_meth;
11895 jmethodID handle_update_fail_malformed_htlc_meth;
11896 jmethodID handle_commitment_signed_meth;
11897 jmethodID handle_revoke_and_ack_meth;
11898 jmethodID handle_update_fee_meth;
11899 jmethodID handle_announcement_signatures_meth;
11900 jmethodID peer_disconnected_meth;
11901 jmethodID peer_connected_meth;
11902 jmethodID handle_channel_reestablish_meth;
11903 jmethodID handle_channel_update_meth;
11904 jmethodID handle_error_meth;
11905 } LDKChannelMessageHandler_JCalls;
11906 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
11907 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11908 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11910 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11911 if (get_jenv_res == JNI_EDETACHED) {
11912 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11914 DO_ASSERT(get_jenv_res == JNI_OK);
11916 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11917 if (get_jenv_res == JNI_EDETACHED) {
11918 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11923 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
11924 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11926 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11927 if (get_jenv_res == JNI_EDETACHED) {
11928 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11930 DO_ASSERT(get_jenv_res == JNI_OK);
11932 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11933 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11934 LDKInitFeatures their_features_var = their_features;
11935 int64_t their_features_ref = 0;
11936 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11937 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11938 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11939 their_features_ref = (uintptr_t)their_features_var.inner;
11940 if (their_features_var.is_owned) {
11941 their_features_ref |= 1;
11943 LDKOpenChannel msg_var = *msg;
11944 int64_t msg_ref = 0;
11945 msg_var = OpenChannel_clone(&msg_var);
11946 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11947 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11948 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11949 msg_ref = (uintptr_t)msg_var.inner;
11950 if (msg_var.is_owned) {
11953 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11954 CHECK(obj != NULL);
11955 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11956 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11957 (*env)->ExceptionDescribe(env);
11958 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
11960 if (get_jenv_res == JNI_EDETACHED) {
11961 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11964 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
11965 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11967 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11968 if (get_jenv_res == JNI_EDETACHED) {
11969 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11971 DO_ASSERT(get_jenv_res == JNI_OK);
11973 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11974 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11975 LDKInitFeatures their_features_var = their_features;
11976 int64_t their_features_ref = 0;
11977 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11978 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11979 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11980 their_features_ref = (uintptr_t)their_features_var.inner;
11981 if (their_features_var.is_owned) {
11982 their_features_ref |= 1;
11984 LDKAcceptChannel msg_var = *msg;
11985 int64_t msg_ref = 0;
11986 msg_var = AcceptChannel_clone(&msg_var);
11987 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11988 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11989 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11990 msg_ref = (uintptr_t)msg_var.inner;
11991 if (msg_var.is_owned) {
11994 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11995 CHECK(obj != NULL);
11996 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11997 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11998 (*env)->ExceptionDescribe(env);
11999 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
12001 if (get_jenv_res == JNI_EDETACHED) {
12002 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12005 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
12006 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12008 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12009 if (get_jenv_res == JNI_EDETACHED) {
12010 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12012 DO_ASSERT(get_jenv_res == JNI_OK);
12014 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12015 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12016 LDKFundingCreated msg_var = *msg;
12017 int64_t msg_ref = 0;
12018 msg_var = FundingCreated_clone(&msg_var);
12019 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12020 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12021 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12022 msg_ref = (uintptr_t)msg_var.inner;
12023 if (msg_var.is_owned) {
12026 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12027 CHECK(obj != NULL);
12028 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
12029 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12030 (*env)->ExceptionDescribe(env);
12031 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
12033 if (get_jenv_res == JNI_EDETACHED) {
12034 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12037 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
12038 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12040 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12041 if (get_jenv_res == JNI_EDETACHED) {
12042 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12044 DO_ASSERT(get_jenv_res == JNI_OK);
12046 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12047 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12048 LDKFundingSigned msg_var = *msg;
12049 int64_t msg_ref = 0;
12050 msg_var = FundingSigned_clone(&msg_var);
12051 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12052 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12053 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12054 msg_ref = (uintptr_t)msg_var.inner;
12055 if (msg_var.is_owned) {
12058 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12059 CHECK(obj != NULL);
12060 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
12061 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12062 (*env)->ExceptionDescribe(env);
12063 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
12065 if (get_jenv_res == JNI_EDETACHED) {
12066 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12069 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
12070 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12072 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12073 if (get_jenv_res == JNI_EDETACHED) {
12074 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12076 DO_ASSERT(get_jenv_res == JNI_OK);
12078 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12079 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12080 LDKChannelReady msg_var = *msg;
12081 int64_t msg_ref = 0;
12082 msg_var = ChannelReady_clone(&msg_var);
12083 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12084 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12085 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12086 msg_ref = (uintptr_t)msg_var.inner;
12087 if (msg_var.is_owned) {
12090 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12091 CHECK(obj != NULL);
12092 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
12093 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12094 (*env)->ExceptionDescribe(env);
12095 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
12097 if (get_jenv_res == JNI_EDETACHED) {
12098 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12101 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
12102 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12104 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12105 if (get_jenv_res == JNI_EDETACHED) {
12106 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12108 DO_ASSERT(get_jenv_res == JNI_OK);
12110 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12111 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12112 LDKInitFeatures their_features_var = *their_features;
12113 int64_t their_features_ref = 0;
12114 their_features_var = InitFeatures_clone(&their_features_var);
12115 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12116 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12117 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
12118 their_features_ref = (uintptr_t)their_features_var.inner;
12119 if (their_features_var.is_owned) {
12120 their_features_ref |= 1;
12122 LDKShutdown msg_var = *msg;
12123 int64_t msg_ref = 0;
12124 msg_var = Shutdown_clone(&msg_var);
12125 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12126 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12127 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12128 msg_ref = (uintptr_t)msg_var.inner;
12129 if (msg_var.is_owned) {
12132 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12133 CHECK(obj != NULL);
12134 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
12135 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12136 (*env)->ExceptionDescribe(env);
12137 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
12139 if (get_jenv_res == JNI_EDETACHED) {
12140 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12143 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
12144 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12146 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12147 if (get_jenv_res == JNI_EDETACHED) {
12148 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12150 DO_ASSERT(get_jenv_res == JNI_OK);
12152 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12153 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12154 LDKClosingSigned msg_var = *msg;
12155 int64_t msg_ref = 0;
12156 msg_var = ClosingSigned_clone(&msg_var);
12157 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12158 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12159 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12160 msg_ref = (uintptr_t)msg_var.inner;
12161 if (msg_var.is_owned) {
12164 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12165 CHECK(obj != NULL);
12166 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
12167 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12168 (*env)->ExceptionDescribe(env);
12169 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
12171 if (get_jenv_res == JNI_EDETACHED) {
12172 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12175 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
12176 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12178 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12179 if (get_jenv_res == JNI_EDETACHED) {
12180 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12182 DO_ASSERT(get_jenv_res == JNI_OK);
12184 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12185 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12186 LDKUpdateAddHTLC msg_var = *msg;
12187 int64_t msg_ref = 0;
12188 msg_var = UpdateAddHTLC_clone(&msg_var);
12189 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12190 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12191 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12192 msg_ref = (uintptr_t)msg_var.inner;
12193 if (msg_var.is_owned) {
12196 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12197 CHECK(obj != NULL);
12198 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
12199 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12200 (*env)->ExceptionDescribe(env);
12201 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
12203 if (get_jenv_res == JNI_EDETACHED) {
12204 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12207 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
12208 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12210 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12211 if (get_jenv_res == JNI_EDETACHED) {
12212 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12214 DO_ASSERT(get_jenv_res == JNI_OK);
12216 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12217 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12218 LDKUpdateFulfillHTLC msg_var = *msg;
12219 int64_t msg_ref = 0;
12220 msg_var = UpdateFulfillHTLC_clone(&msg_var);
12221 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12222 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12223 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12224 msg_ref = (uintptr_t)msg_var.inner;
12225 if (msg_var.is_owned) {
12228 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12229 CHECK(obj != NULL);
12230 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
12231 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12232 (*env)->ExceptionDescribe(env);
12233 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
12235 if (get_jenv_res == JNI_EDETACHED) {
12236 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12239 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
12240 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12242 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12243 if (get_jenv_res == JNI_EDETACHED) {
12244 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12246 DO_ASSERT(get_jenv_res == JNI_OK);
12248 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12249 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12250 LDKUpdateFailHTLC msg_var = *msg;
12251 int64_t msg_ref = 0;
12252 msg_var = UpdateFailHTLC_clone(&msg_var);
12253 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12254 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12255 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12256 msg_ref = (uintptr_t)msg_var.inner;
12257 if (msg_var.is_owned) {
12260 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12261 CHECK(obj != NULL);
12262 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
12263 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12264 (*env)->ExceptionDescribe(env);
12265 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
12267 if (get_jenv_res == JNI_EDETACHED) {
12268 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12271 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
12272 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12274 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12275 if (get_jenv_res == JNI_EDETACHED) {
12276 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12278 DO_ASSERT(get_jenv_res == JNI_OK);
12280 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12281 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12282 LDKUpdateFailMalformedHTLC msg_var = *msg;
12283 int64_t msg_ref = 0;
12284 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
12285 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12286 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12287 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12288 msg_ref = (uintptr_t)msg_var.inner;
12289 if (msg_var.is_owned) {
12292 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12293 CHECK(obj != NULL);
12294 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
12295 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12296 (*env)->ExceptionDescribe(env);
12297 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
12299 if (get_jenv_res == JNI_EDETACHED) {
12300 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12303 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
12304 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12306 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12307 if (get_jenv_res == JNI_EDETACHED) {
12308 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12310 DO_ASSERT(get_jenv_res == JNI_OK);
12312 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12313 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12314 LDKCommitmentSigned msg_var = *msg;
12315 int64_t msg_ref = 0;
12316 msg_var = CommitmentSigned_clone(&msg_var);
12317 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12318 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12319 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12320 msg_ref = (uintptr_t)msg_var.inner;
12321 if (msg_var.is_owned) {
12324 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12325 CHECK(obj != NULL);
12326 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
12327 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12328 (*env)->ExceptionDescribe(env);
12329 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
12331 if (get_jenv_res == JNI_EDETACHED) {
12332 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12335 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12336 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12338 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12339 if (get_jenv_res == JNI_EDETACHED) {
12340 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12342 DO_ASSERT(get_jenv_res == JNI_OK);
12344 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12345 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12346 LDKRevokeAndACK msg_var = *msg;
12347 int64_t msg_ref = 0;
12348 msg_var = RevokeAndACK_clone(&msg_var);
12349 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12350 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12351 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12352 msg_ref = (uintptr_t)msg_var.inner;
12353 if (msg_var.is_owned) {
12356 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12357 CHECK(obj != NULL);
12358 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
12359 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12360 (*env)->ExceptionDescribe(env);
12361 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
12363 if (get_jenv_res == JNI_EDETACHED) {
12364 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12367 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12368 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12370 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12371 if (get_jenv_res == JNI_EDETACHED) {
12372 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12374 DO_ASSERT(get_jenv_res == JNI_OK);
12376 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12377 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12378 LDKUpdateFee msg_var = *msg;
12379 int64_t msg_ref = 0;
12380 msg_var = UpdateFee_clone(&msg_var);
12381 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12382 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12383 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12384 msg_ref = (uintptr_t)msg_var.inner;
12385 if (msg_var.is_owned) {
12388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12389 CHECK(obj != NULL);
12390 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
12391 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12392 (*env)->ExceptionDescribe(env);
12393 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
12395 if (get_jenv_res == JNI_EDETACHED) {
12396 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12399 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12400 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12402 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12403 if (get_jenv_res == JNI_EDETACHED) {
12404 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12406 DO_ASSERT(get_jenv_res == JNI_OK);
12408 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12409 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12410 LDKAnnouncementSignatures msg_var = *msg;
12411 int64_t msg_ref = 0;
12412 msg_var = AnnouncementSignatures_clone(&msg_var);
12413 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12414 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12415 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12416 msg_ref = (uintptr_t)msg_var.inner;
12417 if (msg_var.is_owned) {
12420 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12421 CHECK(obj != NULL);
12422 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
12423 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12424 (*env)->ExceptionDescribe(env);
12425 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
12427 if (get_jenv_res == JNI_EDETACHED) {
12428 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12431 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
12432 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12434 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12435 if (get_jenv_res == JNI_EDETACHED) {
12436 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12438 DO_ASSERT(get_jenv_res == JNI_OK);
12440 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12441 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12442 jboolean no_connection_possible_conv = no_connection_possible;
12443 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12444 CHECK(obj != NULL);
12445 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
12446 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12447 (*env)->ExceptionDescribe(env);
12448 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
12450 if (get_jenv_res == JNI_EDETACHED) {
12451 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12454 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
12455 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12457 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12458 if (get_jenv_res == JNI_EDETACHED) {
12459 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12461 DO_ASSERT(get_jenv_res == JNI_OK);
12463 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12464 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12465 LDKInit msg_var = *msg;
12466 int64_t msg_ref = 0;
12467 msg_var = Init_clone(&msg_var);
12468 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12469 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12470 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12471 msg_ref = (uintptr_t)msg_var.inner;
12472 if (msg_var.is_owned) {
12475 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12476 CHECK(obj != NULL);
12477 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
12478 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12479 (*env)->ExceptionDescribe(env);
12480 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
12482 if (get_jenv_res == JNI_EDETACHED) {
12483 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12486 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12487 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12489 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12490 if (get_jenv_res == JNI_EDETACHED) {
12491 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12493 DO_ASSERT(get_jenv_res == JNI_OK);
12495 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12496 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12497 LDKChannelReestablish msg_var = *msg;
12498 int64_t msg_ref = 0;
12499 msg_var = ChannelReestablish_clone(&msg_var);
12500 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12501 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12502 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12503 msg_ref = (uintptr_t)msg_var.inner;
12504 if (msg_var.is_owned) {
12507 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12508 CHECK(obj != NULL);
12509 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
12510 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12511 (*env)->ExceptionDescribe(env);
12512 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
12514 if (get_jenv_res == JNI_EDETACHED) {
12515 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12518 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12519 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12521 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12522 if (get_jenv_res == JNI_EDETACHED) {
12523 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12525 DO_ASSERT(get_jenv_res == JNI_OK);
12527 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12528 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12529 LDKChannelUpdate msg_var = *msg;
12530 int64_t msg_ref = 0;
12531 msg_var = ChannelUpdate_clone(&msg_var);
12532 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12533 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12534 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12535 msg_ref = (uintptr_t)msg_var.inner;
12536 if (msg_var.is_owned) {
12539 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12540 CHECK(obj != NULL);
12541 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
12542 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12543 (*env)->ExceptionDescribe(env);
12544 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
12546 if (get_jenv_res == JNI_EDETACHED) {
12547 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12550 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12551 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12553 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12554 if (get_jenv_res == JNI_EDETACHED) {
12555 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12557 DO_ASSERT(get_jenv_res == JNI_OK);
12559 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12560 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12561 LDKErrorMessage msg_var = *msg;
12562 int64_t msg_ref = 0;
12563 msg_var = ErrorMessage_clone(&msg_var);
12564 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12565 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12566 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12567 msg_ref = (uintptr_t)msg_var.inner;
12568 if (msg_var.is_owned) {
12571 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12572 CHECK(obj != NULL);
12573 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
12574 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12575 (*env)->ExceptionDescribe(env);
12576 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
12578 if (get_jenv_res == JNI_EDETACHED) {
12579 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12582 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
12583 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
12584 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12585 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12587 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12588 jclass c = (*env)->GetObjectClass(env, o);
12590 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
12591 atomic_init(&calls->refcnt, 1);
12592 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12593 calls->o = (*env)->NewWeakGlobalRef(env, o);
12594 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
12595 CHECK(calls->handle_open_channel_meth != NULL);
12596 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
12597 CHECK(calls->handle_accept_channel_meth != NULL);
12598 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
12599 CHECK(calls->handle_funding_created_meth != NULL);
12600 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
12601 CHECK(calls->handle_funding_signed_meth != NULL);
12602 calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
12603 CHECK(calls->handle_channel_ready_meth != NULL);
12604 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
12605 CHECK(calls->handle_shutdown_meth != NULL);
12606 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
12607 CHECK(calls->handle_closing_signed_meth != NULL);
12608 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
12609 CHECK(calls->handle_update_add_htlc_meth != NULL);
12610 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
12611 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
12612 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
12613 CHECK(calls->handle_update_fail_htlc_meth != NULL);
12614 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
12615 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
12616 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
12617 CHECK(calls->handle_commitment_signed_meth != NULL);
12618 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
12619 CHECK(calls->handle_revoke_and_ack_meth != NULL);
12620 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
12621 CHECK(calls->handle_update_fee_meth != NULL);
12622 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
12623 CHECK(calls->handle_announcement_signatures_meth != NULL);
12624 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
12625 CHECK(calls->peer_disconnected_meth != NULL);
12626 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12627 CHECK(calls->peer_connected_meth != NULL);
12628 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
12629 CHECK(calls->handle_channel_reestablish_meth != NULL);
12630 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
12631 CHECK(calls->handle_channel_update_meth != NULL);
12632 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
12633 CHECK(calls->handle_error_meth != NULL);
12635 LDKChannelMessageHandler ret = {
12636 .this_arg = (void*) calls,
12637 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
12638 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12639 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12640 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12641 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12642 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12643 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12644 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12645 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12646 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12647 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12648 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12649 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12650 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12651 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12652 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12653 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12654 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12655 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12656 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12657 .free = LDKChannelMessageHandler_JCalls_free,
12658 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12660 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12664 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12665 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12666 return (uint64_t)res_ptr;
12668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12669 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
12670 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
12671 DO_ASSERT((res_ptr & 1) == 0);
12672 return (int64_t)(res_ptr | 1);
12674 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) {
12675 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12676 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12677 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12678 LDKPublicKey their_node_id_ref;
12679 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12680 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12681 LDKInitFeatures their_features_conv;
12682 their_features_conv.inner = (void*)(their_features & (~1));
12683 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12684 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12685 their_features_conv = InitFeatures_clone(&their_features_conv);
12686 LDKOpenChannel msg_conv;
12687 msg_conv.inner = (void*)(msg & (~1));
12688 msg_conv.is_owned = false;
12689 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12690 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12693 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) {
12694 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12695 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12696 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12697 LDKPublicKey their_node_id_ref;
12698 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12699 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12700 LDKInitFeatures their_features_conv;
12701 their_features_conv.inner = (void*)(their_features & (~1));
12702 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
12703 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12704 their_features_conv = InitFeatures_clone(&their_features_conv);
12705 LDKAcceptChannel msg_conv;
12706 msg_conv.inner = (void*)(msg & (~1));
12707 msg_conv.is_owned = false;
12708 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12709 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12712 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) {
12713 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12714 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12715 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12716 LDKPublicKey their_node_id_ref;
12717 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12718 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12719 LDKFundingCreated msg_conv;
12720 msg_conv.inner = (void*)(msg & (~1));
12721 msg_conv.is_owned = false;
12722 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12723 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12726 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) {
12727 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12728 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12729 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12730 LDKPublicKey their_node_id_ref;
12731 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12732 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12733 LDKFundingSigned msg_conv;
12734 msg_conv.inner = (void*)(msg & (~1));
12735 msg_conv.is_owned = false;
12736 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12737 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
12741 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12742 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12743 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12744 LDKPublicKey their_node_id_ref;
12745 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12746 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12747 LDKChannelReady msg_conv;
12748 msg_conv.inner = (void*)(msg & (~1));
12749 msg_conv.is_owned = false;
12750 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12751 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12754 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) {
12755 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12756 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12757 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12758 LDKPublicKey their_node_id_ref;
12759 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12760 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12761 LDKInitFeatures their_features_conv;
12762 their_features_conv.inner = (void*)(their_features & (~1));
12763 their_features_conv.is_owned = false;
12764 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12765 LDKShutdown msg_conv;
12766 msg_conv.inner = (void*)(msg & (~1));
12767 msg_conv.is_owned = false;
12768 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12769 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
12772 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) {
12773 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12774 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12775 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12776 LDKPublicKey their_node_id_ref;
12777 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12778 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12779 LDKClosingSigned msg_conv;
12780 msg_conv.inner = (void*)(msg & (~1));
12781 msg_conv.is_owned = false;
12782 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12783 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12786 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) {
12787 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12788 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12789 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12790 LDKPublicKey their_node_id_ref;
12791 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12792 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12793 LDKUpdateAddHTLC msg_conv;
12794 msg_conv.inner = (void*)(msg & (~1));
12795 msg_conv.is_owned = false;
12796 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12797 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12800 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) {
12801 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12802 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12803 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12804 LDKPublicKey their_node_id_ref;
12805 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12806 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12807 LDKUpdateFulfillHTLC msg_conv;
12808 msg_conv.inner = (void*)(msg & (~1));
12809 msg_conv.is_owned = false;
12810 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12811 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12814 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) {
12815 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12816 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12817 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12818 LDKPublicKey their_node_id_ref;
12819 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12820 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12821 LDKUpdateFailHTLC msg_conv;
12822 msg_conv.inner = (void*)(msg & (~1));
12823 msg_conv.is_owned = false;
12824 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12825 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12828 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) {
12829 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12830 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12831 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12832 LDKPublicKey their_node_id_ref;
12833 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12834 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12835 LDKUpdateFailMalformedHTLC msg_conv;
12836 msg_conv.inner = (void*)(msg & (~1));
12837 msg_conv.is_owned = false;
12838 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12839 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12842 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) {
12843 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12844 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12845 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12846 LDKPublicKey their_node_id_ref;
12847 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12848 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12849 LDKCommitmentSigned msg_conv;
12850 msg_conv.inner = (void*)(msg & (~1));
12851 msg_conv.is_owned = false;
12852 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12853 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12856 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) {
12857 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12858 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12859 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12860 LDKPublicKey their_node_id_ref;
12861 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12862 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12863 LDKRevokeAndACK msg_conv;
12864 msg_conv.inner = (void*)(msg & (~1));
12865 msg_conv.is_owned = false;
12866 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12867 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12870 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) {
12871 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12872 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12873 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12874 LDKPublicKey their_node_id_ref;
12875 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12876 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12877 LDKUpdateFee msg_conv;
12878 msg_conv.inner = (void*)(msg & (~1));
12879 msg_conv.is_owned = false;
12880 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12881 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12884 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) {
12885 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12886 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12887 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12888 LDKPublicKey their_node_id_ref;
12889 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12890 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12891 LDKAnnouncementSignatures msg_conv;
12892 msg_conv.inner = (void*)(msg & (~1));
12893 msg_conv.is_owned = false;
12894 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12895 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12898 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) {
12899 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12900 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12901 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12902 LDKPublicKey their_node_id_ref;
12903 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12904 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12905 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
12908 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) {
12909 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12910 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12911 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12912 LDKPublicKey their_node_id_ref;
12913 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12914 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12916 msg_conv.inner = (void*)(msg & (~1));
12917 msg_conv.is_owned = false;
12918 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12919 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12922 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) {
12923 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12924 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12925 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12926 LDKPublicKey their_node_id_ref;
12927 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12928 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12929 LDKChannelReestablish msg_conv;
12930 msg_conv.inner = (void*)(msg & (~1));
12931 msg_conv.is_owned = false;
12932 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12933 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12936 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) {
12937 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12938 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12939 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12940 LDKPublicKey their_node_id_ref;
12941 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12942 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12943 LDKChannelUpdate msg_conv;
12944 msg_conv.inner = (void*)(msg & (~1));
12945 msg_conv.is_owned = false;
12946 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12947 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12950 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) {
12951 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12952 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12953 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12954 LDKPublicKey their_node_id_ref;
12955 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12956 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12957 LDKErrorMessage msg_conv;
12958 msg_conv.inner = (void*)(msg & (~1));
12959 msg_conv.is_owned = false;
12960 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12961 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12964 typedef struct LDKRoutingMessageHandler_JCalls {
12965 atomic_size_t refcnt;
12968 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12969 jmethodID handle_node_announcement_meth;
12970 jmethodID handle_channel_announcement_meth;
12971 jmethodID handle_channel_update_meth;
12972 jmethodID get_next_channel_announcements_meth;
12973 jmethodID get_next_node_announcements_meth;
12974 jmethodID peer_connected_meth;
12975 jmethodID handle_reply_channel_range_meth;
12976 jmethodID handle_reply_short_channel_ids_end_meth;
12977 jmethodID handle_query_channel_range_meth;
12978 jmethodID handle_query_short_channel_ids_meth;
12979 } LDKRoutingMessageHandler_JCalls;
12980 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
12981 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12982 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12984 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12985 if (get_jenv_res == JNI_EDETACHED) {
12986 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12988 DO_ASSERT(get_jenv_res == JNI_OK);
12990 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12991 if (get_jenv_res == JNI_EDETACHED) {
12992 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12997 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
12998 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13000 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13001 if (get_jenv_res == JNI_EDETACHED) {
13002 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13004 DO_ASSERT(get_jenv_res == JNI_OK);
13006 LDKNodeAnnouncement msg_var = *msg;
13007 int64_t msg_ref = 0;
13008 msg_var = NodeAnnouncement_clone(&msg_var);
13009 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13010 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13011 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13012 msg_ref = (uintptr_t)msg_var.inner;
13013 if (msg_var.is_owned) {
13016 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13017 CHECK(obj != NULL);
13018 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
13019 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13020 (*env)->ExceptionDescribe(env);
13021 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
13023 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13024 CHECK_ACCESS(ret_ptr);
13025 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13027 if (get_jenv_res == JNI_EDETACHED) {
13028 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13032 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
13033 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13035 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13036 if (get_jenv_res == JNI_EDETACHED) {
13037 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13039 DO_ASSERT(get_jenv_res == JNI_OK);
13041 LDKChannelAnnouncement msg_var = *msg;
13042 int64_t msg_ref = 0;
13043 msg_var = ChannelAnnouncement_clone(&msg_var);
13044 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13045 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13046 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13047 msg_ref = (uintptr_t)msg_var.inner;
13048 if (msg_var.is_owned) {
13051 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13052 CHECK(obj != NULL);
13053 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
13054 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13055 (*env)->ExceptionDescribe(env);
13056 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
13058 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13059 CHECK_ACCESS(ret_ptr);
13060 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13062 if (get_jenv_res == JNI_EDETACHED) {
13063 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13067 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
13068 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13070 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13071 if (get_jenv_res == JNI_EDETACHED) {
13072 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13074 DO_ASSERT(get_jenv_res == JNI_OK);
13076 LDKChannelUpdate msg_var = *msg;
13077 int64_t msg_ref = 0;
13078 msg_var = ChannelUpdate_clone(&msg_var);
13079 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13080 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13081 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13082 msg_ref = (uintptr_t)msg_var.inner;
13083 if (msg_var.is_owned) {
13086 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13087 CHECK(obj != NULL);
13088 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
13089 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13090 (*env)->ExceptionDescribe(env);
13091 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
13093 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13094 CHECK_ACCESS(ret_ptr);
13095 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13097 if (get_jenv_res == JNI_EDETACHED) {
13098 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13102 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
13103 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13105 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13106 if (get_jenv_res == JNI_EDETACHED) {
13107 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13109 DO_ASSERT(get_jenv_res == JNI_OK);
13111 int64_t starting_point_conv = starting_point;
13112 int8_t batch_amount_conv = batch_amount;
13113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13114 CHECK(obj != NULL);
13115 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
13116 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13117 (*env)->ExceptionDescribe(env);
13118 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
13120 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
13121 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13122 if (ret_constr.datalen > 0)
13123 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13125 ret_constr.data = NULL;
13126 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13127 for (size_t h = 0; h < ret_constr.datalen; h++) {
13128 int64_t ret_conv_59 = ret_vals[h];
13129 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
13130 CHECK_ACCESS(ret_conv_59_ptr);
13131 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
13132 FREE((void*)ret_conv_59);
13133 ret_constr.data[h] = ret_conv_59_conv;
13135 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13136 if (get_jenv_res == JNI_EDETACHED) {
13137 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13141 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
13142 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13144 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13145 if (get_jenv_res == JNI_EDETACHED) {
13146 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13148 DO_ASSERT(get_jenv_res == JNI_OK);
13150 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
13151 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
13152 int8_t batch_amount_conv = batch_amount;
13153 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13154 CHECK(obj != NULL);
13155 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
13156 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13157 (*env)->ExceptionDescribe(env);
13158 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
13160 LDKCVec_NodeAnnouncementZ ret_constr;
13161 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13162 if (ret_constr.datalen > 0)
13163 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13165 ret_constr.data = NULL;
13166 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13167 for (size_t s = 0; s < ret_constr.datalen; s++) {
13168 int64_t ret_conv_18 = ret_vals[s];
13169 LDKNodeAnnouncement ret_conv_18_conv;
13170 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
13171 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
13172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
13173 ret_constr.data[s] = ret_conv_18_conv;
13175 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13176 if (get_jenv_res == JNI_EDETACHED) {
13177 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13181 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
13182 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13184 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13185 if (get_jenv_res == JNI_EDETACHED) {
13186 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13188 DO_ASSERT(get_jenv_res == JNI_OK);
13190 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13191 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13192 LDKInit init_var = *init;
13193 int64_t init_ref = 0;
13194 init_var = Init_clone(&init_var);
13195 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13196 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13197 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13198 init_ref = (uintptr_t)init_var.inner;
13199 if (init_var.is_owned) {
13202 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13203 CHECK(obj != NULL);
13204 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
13205 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13206 (*env)->ExceptionDescribe(env);
13207 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
13209 if (get_jenv_res == JNI_EDETACHED) {
13210 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13213 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
13214 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13216 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13217 if (get_jenv_res == JNI_EDETACHED) {
13218 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13220 DO_ASSERT(get_jenv_res == JNI_OK);
13222 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13223 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13224 LDKReplyChannelRange msg_var = msg;
13225 int64_t msg_ref = 0;
13226 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13227 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13228 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13229 msg_ref = (uintptr_t)msg_var.inner;
13230 if (msg_var.is_owned) {
13233 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13234 CHECK(obj != NULL);
13235 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
13236 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13237 (*env)->ExceptionDescribe(env);
13238 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
13240 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13241 CHECK_ACCESS(ret_ptr);
13242 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13244 if (get_jenv_res == JNI_EDETACHED) {
13245 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13249 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
13250 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13252 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13253 if (get_jenv_res == JNI_EDETACHED) {
13254 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13256 DO_ASSERT(get_jenv_res == JNI_OK);
13258 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13259 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13260 LDKReplyShortChannelIdsEnd msg_var = msg;
13261 int64_t msg_ref = 0;
13262 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13263 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13264 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13265 msg_ref = (uintptr_t)msg_var.inner;
13266 if (msg_var.is_owned) {
13269 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13270 CHECK(obj != NULL);
13271 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
13272 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13273 (*env)->ExceptionDescribe(env);
13274 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
13276 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13277 CHECK_ACCESS(ret_ptr);
13278 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13280 if (get_jenv_res == JNI_EDETACHED) {
13281 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13285 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
13286 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13288 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13289 if (get_jenv_res == JNI_EDETACHED) {
13290 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13292 DO_ASSERT(get_jenv_res == JNI_OK);
13294 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13295 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13296 LDKQueryChannelRange msg_var = msg;
13297 int64_t msg_ref = 0;
13298 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13299 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13300 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13301 msg_ref = (uintptr_t)msg_var.inner;
13302 if (msg_var.is_owned) {
13305 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13306 CHECK(obj != NULL);
13307 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
13308 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13309 (*env)->ExceptionDescribe(env);
13310 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
13312 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13313 CHECK_ACCESS(ret_ptr);
13314 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13316 if (get_jenv_res == JNI_EDETACHED) {
13317 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13321 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
13322 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13324 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13325 if (get_jenv_res == JNI_EDETACHED) {
13326 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13328 DO_ASSERT(get_jenv_res == JNI_OK);
13330 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13331 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13332 LDKQueryShortChannelIds msg_var = msg;
13333 int64_t msg_ref = 0;
13334 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13335 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13336 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13337 msg_ref = (uintptr_t)msg_var.inner;
13338 if (msg_var.is_owned) {
13341 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13342 CHECK(obj != NULL);
13343 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
13344 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13345 (*env)->ExceptionDescribe(env);
13346 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
13348 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13349 CHECK_ACCESS(ret_ptr);
13350 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13352 if (get_jenv_res == JNI_EDETACHED) {
13353 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13357 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13358 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13359 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13360 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13362 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13363 jclass c = (*env)->GetObjectClass(env, o);
13365 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13366 atomic_init(&calls->refcnt, 1);
13367 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13368 calls->o = (*env)->NewWeakGlobalRef(env, o);
13369 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
13370 CHECK(calls->handle_node_announcement_meth != NULL);
13371 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
13372 CHECK(calls->handle_channel_announcement_meth != NULL);
13373 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
13374 CHECK(calls->handle_channel_update_meth != NULL);
13375 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
13376 CHECK(calls->get_next_channel_announcements_meth != NULL);
13377 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
13378 CHECK(calls->get_next_node_announcements_meth != NULL);
13379 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
13380 CHECK(calls->peer_connected_meth != NULL);
13381 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
13382 CHECK(calls->handle_reply_channel_range_meth != NULL);
13383 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
13384 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
13385 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
13386 CHECK(calls->handle_query_channel_range_meth != NULL);
13387 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
13388 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
13390 LDKRoutingMessageHandler ret = {
13391 .this_arg = (void*) calls,
13392 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13393 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13394 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13395 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
13396 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
13397 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13398 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13399 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13400 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13401 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13402 .free = LDKRoutingMessageHandler_JCalls_free,
13403 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
13405 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13409 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13410 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
13411 return (uint64_t)res_ptr;
13413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
13414 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
13415 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
13416 DO_ASSERT((res_ptr & 1) == 0);
13417 return (int64_t)(res_ptr | 1);
13419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13420 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13421 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13422 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13423 LDKNodeAnnouncement msg_conv;
13424 msg_conv.inner = (void*)(msg & (~1));
13425 msg_conv.is_owned = false;
13426 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13427 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13428 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13429 return (int64_t)ret_conv;
13432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13433 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13434 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13435 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13436 LDKChannelAnnouncement msg_conv;
13437 msg_conv.inner = (void*)(msg & (~1));
13438 msg_conv.is_owned = false;
13439 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13440 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13441 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13442 return (int64_t)ret_conv;
13445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13446 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13447 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13448 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13449 LDKChannelUpdate msg_conv;
13450 msg_conv.inner = (void*)(msg & (~1));
13451 msg_conv.is_owned = false;
13452 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13453 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13454 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13455 return (int64_t)ret_conv;
13458 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) {
13459 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13460 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13461 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13462 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
13463 int64_tArray ret_arr = NULL;
13464 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13465 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13466 for (size_t h = 0; h < ret_var.datalen; h++) {
13467 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13468 *ret_conv_59_conv = ret_var.data[h];
13469 ret_arr_ptr[h] = ((int64_t)ret_conv_59_conv);
13471 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13472 FREE(ret_var.data);
13476 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) {
13477 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13478 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13479 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13480 LDKPublicKey starting_point_ref;
13481 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
13482 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
13483 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
13484 int64_tArray ret_arr = NULL;
13485 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13486 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13487 for (size_t s = 0; s < ret_var.datalen; s++) {
13488 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
13489 int64_t ret_conv_18_ref = 0;
13490 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13491 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
13493 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
13494 if (ret_conv_18_var.is_owned) {
13495 ret_conv_18_ref |= 1;
13497 ret_arr_ptr[s] = ret_conv_18_ref;
13499 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13500 FREE(ret_var.data);
13504 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) {
13505 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13506 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13507 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13508 LDKPublicKey their_node_id_ref;
13509 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13510 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13512 init_conv.inner = (void*)(init & (~1));
13513 init_conv.is_owned = false;
13514 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13515 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
13518 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) {
13519 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13520 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13521 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13522 LDKPublicKey their_node_id_ref;
13523 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13524 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13525 LDKReplyChannelRange msg_conv;
13526 msg_conv.inner = (void*)(msg & (~1));
13527 msg_conv.is_owned = (msg & 1) || (msg == 0);
13528 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13529 msg_conv = ReplyChannelRange_clone(&msg_conv);
13530 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13531 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13532 return (int64_t)ret_conv;
13535 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) {
13536 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13537 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13538 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13539 LDKPublicKey their_node_id_ref;
13540 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13541 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13542 LDKReplyShortChannelIdsEnd msg_conv;
13543 msg_conv.inner = (void*)(msg & (~1));
13544 msg_conv.is_owned = (msg & 1) || (msg == 0);
13545 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13546 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
13547 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13548 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13549 return (int64_t)ret_conv;
13552 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) {
13553 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13554 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13555 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13556 LDKPublicKey their_node_id_ref;
13557 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13558 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13559 LDKQueryChannelRange msg_conv;
13560 msg_conv.inner = (void*)(msg & (~1));
13561 msg_conv.is_owned = (msg & 1) || (msg == 0);
13562 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13563 msg_conv = QueryChannelRange_clone(&msg_conv);
13564 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13565 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13566 return (int64_t)ret_conv;
13569 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) {
13570 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13571 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13572 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13573 LDKPublicKey their_node_id_ref;
13574 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13575 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13576 LDKQueryShortChannelIds msg_conv;
13577 msg_conv.inner = (void*)(msg & (~1));
13578 msg_conv.is_owned = (msg & 1) || (msg == 0);
13579 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13580 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13581 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13582 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13583 return (int64_t)ret_conv;
13586 typedef struct LDKCustomMessageReader_JCalls {
13587 atomic_size_t refcnt;
13590 jmethodID read_meth;
13591 } LDKCustomMessageReader_JCalls;
13592 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13593 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13594 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13596 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13597 if (get_jenv_res == JNI_EDETACHED) {
13598 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13600 DO_ASSERT(get_jenv_res == JNI_OK);
13602 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13603 if (get_jenv_res == JNI_EDETACHED) {
13604 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13609 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13610 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13612 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13613 if (get_jenv_res == JNI_EDETACHED) {
13614 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13616 DO_ASSERT(get_jenv_res == JNI_OK);
13618 int16_t message_type_conv = message_type;
13619 LDKu8slice buffer_var = buffer;
13620 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
13621 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
13622 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13623 CHECK(obj != NULL);
13624 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
13625 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13626 (*env)->ExceptionDescribe(env);
13627 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
13629 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13630 CHECK_ACCESS(ret_ptr);
13631 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13633 if (get_jenv_res == JNI_EDETACHED) {
13634 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13638 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13639 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13640 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13642 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
13643 jclass c = (*env)->GetObjectClass(env, o);
13645 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13646 atomic_init(&calls->refcnt, 1);
13647 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13648 calls->o = (*env)->NewWeakGlobalRef(env, o);
13649 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
13650 CHECK(calls->read_meth != NULL);
13652 LDKCustomMessageReader ret = {
13653 .this_arg = (void*) calls,
13654 .read = read_LDKCustomMessageReader_jcall,
13655 .free = LDKCustomMessageReader_JCalls_free,
13659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
13660 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13661 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
13662 return (uint64_t)res_ptr;
13664 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) {
13665 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13666 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13667 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
13668 LDKu8slice buffer_ref;
13669 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
13670 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
13671 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
13672 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
13673 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
13674 return (int64_t)ret_conv;
13677 typedef struct LDKCustomMessageHandler_JCalls {
13678 atomic_size_t refcnt;
13681 LDKCustomMessageReader_JCalls* CustomMessageReader;
13682 jmethodID handle_custom_message_meth;
13683 jmethodID get_and_clear_pending_msg_meth;
13684 } LDKCustomMessageHandler_JCalls;
13685 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
13686 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13687 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13689 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13690 if (get_jenv_res == JNI_EDETACHED) {
13691 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13693 DO_ASSERT(get_jenv_res == JNI_OK);
13695 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13696 if (get_jenv_res == JNI_EDETACHED) {
13697 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13702 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
13703 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13705 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13706 if (get_jenv_res == JNI_EDETACHED) {
13707 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13709 DO_ASSERT(get_jenv_res == JNI_OK);
13711 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
13713 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
13714 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
13715 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13716 CHECK(obj != NULL);
13717 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (int64_t)msg_ret, sender_node_id_arr);
13718 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13719 (*env)->ExceptionDescribe(env);
13720 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
13722 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13723 CHECK_ACCESS(ret_ptr);
13724 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13726 if (get_jenv_res == JNI_EDETACHED) {
13727 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13731 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
13732 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13734 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13735 if (get_jenv_res == JNI_EDETACHED) {
13736 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13738 DO_ASSERT(get_jenv_res == JNI_OK);
13740 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13741 CHECK(obj != NULL);
13742 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
13743 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13744 (*env)->ExceptionDescribe(env);
13745 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
13747 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
13748 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13749 if (ret_constr.datalen > 0)
13750 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13752 ret_constr.data = NULL;
13753 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13754 for (size_t z = 0; z < ret_constr.datalen; z++) {
13755 int64_t ret_conv_25 = ret_vals[z];
13756 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
13757 CHECK_ACCESS(ret_conv_25_ptr);
13758 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
13759 FREE((void*)ret_conv_25);
13760 ret_constr.data[z] = ret_conv_25_conv;
13762 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13763 if (get_jenv_res == JNI_EDETACHED) {
13764 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13768 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
13769 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
13770 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13771 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
13773 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13774 jclass c = (*env)->GetObjectClass(env, o);
13776 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
13777 atomic_init(&calls->refcnt, 1);
13778 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13779 calls->o = (*env)->NewWeakGlobalRef(env, o);
13780 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
13781 CHECK(calls->handle_custom_message_meth != NULL);
13782 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
13783 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
13785 LDKCustomMessageHandler ret = {
13786 .this_arg = (void*) calls,
13787 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
13788 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
13789 .free = LDKCustomMessageHandler_JCalls_free,
13790 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
13792 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
13795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13796 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
13797 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
13798 return (uint64_t)res_ptr;
13800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
13801 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
13802 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
13803 DO_ASSERT((res_ptr & 1) == 0);
13804 return (int64_t)(res_ptr | 1);
13806 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) {
13807 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13808 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13809 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13810 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
13811 CHECK_ACCESS(msg_ptr);
13812 LDKType msg_conv = *(LDKType*)(msg_ptr);
13813 if (msg_conv.free == LDKType_JCalls_free) {
13814 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13815 LDKType_JCalls_cloned(&msg_conv);
13817 LDKPublicKey sender_node_id_ref;
13818 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
13819 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
13820 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13821 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
13822 return (int64_t)ret_conv;
13825 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
13826 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13827 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13828 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13829 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
13830 int64_tArray ret_arr = NULL;
13831 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13832 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13833 for (size_t z = 0; z < ret_var.datalen; z++) {
13834 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13835 *ret_conv_25_conv = ret_var.data[z];
13836 ret_arr_ptr[z] = ((int64_t)ret_conv_25_conv);
13838 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13839 FREE(ret_var.data);
13843 typedef struct LDKSocketDescriptor_JCalls {
13844 atomic_size_t refcnt;
13847 jmethodID send_data_meth;
13848 jmethodID disconnect_socket_meth;
13850 jmethodID hash_meth;
13851 } LDKSocketDescriptor_JCalls;
13852 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
13853 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13854 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13856 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13857 if (get_jenv_res == JNI_EDETACHED) {
13858 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13860 DO_ASSERT(get_jenv_res == JNI_OK);
13862 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13863 if (get_jenv_res == JNI_EDETACHED) {
13864 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13869 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
13870 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13872 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13873 if (get_jenv_res == JNI_EDETACHED) {
13874 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13876 DO_ASSERT(get_jenv_res == JNI_OK);
13878 LDKu8slice data_var = data;
13879 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
13880 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
13881 jboolean resume_read_conv = resume_read;
13882 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13883 CHECK(obj != NULL);
13884 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
13885 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13886 (*env)->ExceptionDescribe(env);
13887 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
13889 if (get_jenv_res == JNI_EDETACHED) {
13890 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13894 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
13895 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13897 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13898 if (get_jenv_res == JNI_EDETACHED) {
13899 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13901 DO_ASSERT(get_jenv_res == JNI_OK);
13903 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13904 CHECK(obj != NULL);
13905 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
13906 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13907 (*env)->ExceptionDescribe(env);
13908 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
13910 if (get_jenv_res == JNI_EDETACHED) {
13911 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13914 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
13915 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13917 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13918 if (get_jenv_res == JNI_EDETACHED) {
13919 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13921 DO_ASSERT(get_jenv_res == JNI_OK);
13923 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13924 *other_arg_clone = SocketDescriptor_clone(other_arg);
13925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13926 CHECK(obj != NULL);
13927 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (int64_t)other_arg_clone);
13928 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13929 (*env)->ExceptionDescribe(env);
13930 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
13932 if (get_jenv_res == JNI_EDETACHED) {
13933 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13937 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
13938 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13940 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13941 if (get_jenv_res == JNI_EDETACHED) {
13942 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13944 DO_ASSERT(get_jenv_res == JNI_OK);
13946 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13947 CHECK(obj != NULL);
13948 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
13949 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13950 (*env)->ExceptionDescribe(env);
13951 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
13953 if (get_jenv_res == JNI_EDETACHED) {
13954 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13958 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
13959 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
13960 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13962 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
13963 jclass c = (*env)->GetObjectClass(env, o);
13965 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
13966 atomic_init(&calls->refcnt, 1);
13967 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13968 calls->o = (*env)->NewWeakGlobalRef(env, o);
13969 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
13970 CHECK(calls->send_data_meth != NULL);
13971 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
13972 CHECK(calls->disconnect_socket_meth != NULL);
13973 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
13974 CHECK(calls->eq_meth != NULL);
13975 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
13976 CHECK(calls->hash_meth != NULL);
13978 LDKSocketDescriptor ret = {
13979 .this_arg = (void*) calls,
13980 .send_data = send_data_LDKSocketDescriptor_jcall,
13981 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
13982 .eq = eq_LDKSocketDescriptor_jcall,
13983 .hash = hash_LDKSocketDescriptor_jcall,
13984 .cloned = LDKSocketDescriptor_JCalls_cloned,
13985 .free = LDKSocketDescriptor_JCalls_free,
13989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
13990 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13991 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
13992 return (uint64_t)res_ptr;
13994 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) {
13995 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13996 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13997 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13998 LDKu8slice data_ref;
13999 data_ref.datalen = (*env)->GetArrayLength(env, data);
14000 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
14001 int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
14002 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
14006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
14007 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14008 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14009 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14010 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
14013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
14014 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14015 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14016 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14017 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
14021 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
14022 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
14023 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
14024 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
14025 static jclass LDKEffectiveCapacity_Total_class = NULL;
14026 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
14027 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
14028 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
14029 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
14030 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
14031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
14032 LDKEffectiveCapacity_ExactLiquidity_class =
14033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
14034 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
14035 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
14036 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
14037 LDKEffectiveCapacity_MaximumHTLC_class =
14038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
14039 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
14040 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
14041 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
14042 LDKEffectiveCapacity_Total_class =
14043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
14044 CHECK(LDKEffectiveCapacity_Total_class != NULL);
14045 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
14046 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
14047 LDKEffectiveCapacity_Infinite_class =
14048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
14049 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
14050 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
14051 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
14052 LDKEffectiveCapacity_Unknown_class =
14053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
14054 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
14055 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
14056 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
14058 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14059 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
14061 case LDKEffectiveCapacity_ExactLiquidity: {
14062 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
14063 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
14065 case LDKEffectiveCapacity_MaximumHTLC: {
14066 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
14067 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
14069 case LDKEffectiveCapacity_Total: {
14070 int64_t capacity_msat_conv = obj->total.capacity_msat;
14071 int64_t htlc_maximum_msat_ref = ((uintptr_t)&obj->total.htlc_maximum_msat) | 1;
14072 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_ref);
14074 case LDKEffectiveCapacity_Infinite: {
14075 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
14077 case LDKEffectiveCapacity_Unknown: {
14078 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
14083 typedef struct LDKLockableScore_JCalls {
14084 atomic_size_t refcnt;
14087 jmethodID lock_meth;
14088 } LDKLockableScore_JCalls;
14089 static void LDKLockableScore_JCalls_free(void* this_arg) {
14090 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14091 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14093 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14094 if (get_jenv_res == JNI_EDETACHED) {
14095 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14097 DO_ASSERT(get_jenv_res == JNI_OK);
14099 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14100 if (get_jenv_res == JNI_EDETACHED) {
14101 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14106 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
14107 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14109 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14110 if (get_jenv_res == JNI_EDETACHED) {
14111 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14113 DO_ASSERT(get_jenv_res == JNI_OK);
14115 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14116 CHECK(obj != NULL);
14117 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
14118 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14119 (*env)->ExceptionDescribe(env);
14120 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
14122 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14123 CHECK_ACCESS(ret_ptr);
14124 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
14125 if (ret_conv.free == LDKScore_JCalls_free) {
14126 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14127 LDKScore_JCalls_cloned(&ret_conv);
14128 }// WARNING: we may need a move here but no clone is available for LDKScore
14130 if (get_jenv_res == JNI_EDETACHED) {
14131 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14135 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
14136 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
14137 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14139 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
14140 jclass c = (*env)->GetObjectClass(env, o);
14142 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
14143 atomic_init(&calls->refcnt, 1);
14144 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14145 calls->o = (*env)->NewWeakGlobalRef(env, o);
14146 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
14147 CHECK(calls->lock_meth != NULL);
14149 LDKLockableScore ret = {
14150 .this_arg = (void*) calls,
14151 .lock = lock_LDKLockableScore_jcall,
14152 .free = LDKLockableScore_JCalls_free,
14156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
14157 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
14158 *res_ptr = LDKLockableScore_init(env, clz, o);
14159 return (uint64_t)res_ptr;
14161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
14162 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14163 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14164 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14165 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
14166 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
14167 return (int64_t)ret_ret;
14170 static jclass LDKGossipSync_P2P_class = NULL;
14171 static jmethodID LDKGossipSync_P2P_meth = NULL;
14172 static jclass LDKGossipSync_Rapid_class = NULL;
14173 static jmethodID LDKGossipSync_Rapid_meth = NULL;
14174 static jclass LDKGossipSync_None_class = NULL;
14175 static jmethodID LDKGossipSync_None_meth = NULL;
14176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
14177 LDKGossipSync_P2P_class =
14178 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
14179 CHECK(LDKGossipSync_P2P_class != NULL);
14180 LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
14181 CHECK(LDKGossipSync_P2P_meth != NULL);
14182 LDKGossipSync_Rapid_class =
14183 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
14184 CHECK(LDKGossipSync_Rapid_class != NULL);
14185 LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
14186 CHECK(LDKGossipSync_Rapid_meth != NULL);
14187 LDKGossipSync_None_class =
14188 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
14189 CHECK(LDKGossipSync_None_class != NULL);
14190 LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
14191 CHECK(LDKGossipSync_None_meth != NULL);
14193 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14194 LDKGossipSync *obj = (LDKGossipSync*)(ptr & ~1);
14196 case LDKGossipSync_P2P: {
14197 LDKP2PGossipSync p2p_var = obj->p2p;
14198 int64_t p2p_ref = 0;
14199 CHECK((((uintptr_t)p2p_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14200 CHECK((((uintptr_t)&p2p_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14201 CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
14202 p2p_ref = (uintptr_t)p2p_var.inner & ~1;
14203 return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
14205 case LDKGossipSync_Rapid: {
14206 LDKRapidGossipSync rapid_var = obj->rapid;
14207 int64_t rapid_ref = 0;
14208 CHECK((((uintptr_t)rapid_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14209 CHECK((((uintptr_t)&rapid_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14210 CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
14211 rapid_ref = (uintptr_t)rapid_var.inner & ~1;
14212 return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
14214 case LDKGossipSync_None: {
14215 return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
14220 static jclass LDKFallback_SegWitProgram_class = NULL;
14221 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
14222 static jclass LDKFallback_PubKeyHash_class = NULL;
14223 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
14224 static jclass LDKFallback_ScriptHash_class = NULL;
14225 static jmethodID LDKFallback_ScriptHash_meth = NULL;
14226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
14227 LDKFallback_SegWitProgram_class =
14228 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
14229 CHECK(LDKFallback_SegWitProgram_class != NULL);
14230 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
14231 CHECK(LDKFallback_SegWitProgram_meth != NULL);
14232 LDKFallback_PubKeyHash_class =
14233 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
14234 CHECK(LDKFallback_PubKeyHash_class != NULL);
14235 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
14236 CHECK(LDKFallback_PubKeyHash_meth != NULL);
14237 LDKFallback_ScriptHash_class =
14238 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
14239 CHECK(LDKFallback_ScriptHash_class != NULL);
14240 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
14241 CHECK(LDKFallback_ScriptHash_meth != NULL);
14243 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14244 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
14246 case LDKFallback_SegWitProgram: {
14247 uint8_t version_val = obj->seg_wit_program.version._0;
14248 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
14249 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
14250 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
14251 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
14253 case LDKFallback_PubKeyHash: {
14254 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
14255 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
14256 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
14258 case LDKFallback_ScriptHash: {
14259 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
14260 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
14261 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
14266 typedef struct LDKPayer_JCalls {
14267 atomic_size_t refcnt;
14270 jmethodID node_id_meth;
14271 jmethodID first_hops_meth;
14272 jmethodID send_payment_meth;
14273 jmethodID send_spontaneous_payment_meth;
14274 jmethodID retry_payment_meth;
14275 jmethodID abandon_payment_meth;
14277 static void LDKPayer_JCalls_free(void* this_arg) {
14278 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14279 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14281 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14282 if (get_jenv_res == JNI_EDETACHED) {
14283 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14285 DO_ASSERT(get_jenv_res == JNI_OK);
14287 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14288 if (get_jenv_res == JNI_EDETACHED) {
14289 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14294 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
14295 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14297 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14298 if (get_jenv_res == JNI_EDETACHED) {
14299 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14301 DO_ASSERT(get_jenv_res == JNI_OK);
14303 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14304 CHECK(obj != NULL);
14305 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
14306 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14307 (*env)->ExceptionDescribe(env);
14308 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
14310 LDKPublicKey ret_ref;
14311 CHECK((*env)->GetArrayLength(env, ret) == 33);
14312 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
14313 if (get_jenv_res == JNI_EDETACHED) {
14314 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14318 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
14319 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14321 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14322 if (get_jenv_res == JNI_EDETACHED) {
14323 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14325 DO_ASSERT(get_jenv_res == JNI_OK);
14327 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14328 CHECK(obj != NULL);
14329 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
14330 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14331 (*env)->ExceptionDescribe(env);
14332 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
14334 LDKCVec_ChannelDetailsZ ret_constr;
14335 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14336 if (ret_constr.datalen > 0)
14337 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14339 ret_constr.data = NULL;
14340 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14341 for (size_t q = 0; q < ret_constr.datalen; q++) {
14342 int64_t ret_conv_16 = ret_vals[q];
14343 LDKChannelDetails ret_conv_16_conv;
14344 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
14345 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
14346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
14347 ret_constr.data[q] = ret_conv_16_conv;
14349 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14350 if (get_jenv_res == JNI_EDETACHED) {
14351 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14355 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
14356 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14358 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14359 if (get_jenv_res == JNI_EDETACHED) {
14360 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14362 DO_ASSERT(get_jenv_res == JNI_OK);
14364 LDKRoute route_var = *route;
14365 int64_t route_ref = 0;
14366 route_var = Route_clone(&route_var);
14367 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14368 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14369 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14370 route_ref = (uintptr_t)route_var.inner;
14371 if (route_var.is_owned) {
14374 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14375 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
14376 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14377 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
14378 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14379 CHECK(obj != NULL);
14380 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
14381 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14382 (*env)->ExceptionDescribe(env);
14383 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
14385 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14386 CHECK_ACCESS(ret_ptr);
14387 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14389 if (get_jenv_res == JNI_EDETACHED) {
14390 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14394 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
14395 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14397 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14398 if (get_jenv_res == JNI_EDETACHED) {
14399 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14401 DO_ASSERT(get_jenv_res == JNI_OK);
14403 LDKRoute route_var = *route;
14404 int64_t route_ref = 0;
14405 route_var = Route_clone(&route_var);
14406 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14407 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14408 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14409 route_ref = (uintptr_t)route_var.inner;
14410 if (route_var.is_owned) {
14413 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
14414 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
14415 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14416 CHECK(obj != NULL);
14417 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
14418 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14419 (*env)->ExceptionDescribe(env);
14420 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
14422 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14423 CHECK_ACCESS(ret_ptr);
14424 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14426 if (get_jenv_res == JNI_EDETACHED) {
14427 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14431 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
14432 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14434 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14435 if (get_jenv_res == JNI_EDETACHED) {
14436 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14438 DO_ASSERT(get_jenv_res == JNI_OK);
14440 LDKRoute route_var = *route;
14441 int64_t route_ref = 0;
14442 route_var = Route_clone(&route_var);
14443 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14444 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14445 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14446 route_ref = (uintptr_t)route_var.inner;
14447 if (route_var.is_owned) {
14450 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14451 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14452 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14453 CHECK(obj != NULL);
14454 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
14455 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14456 (*env)->ExceptionDescribe(env);
14457 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
14459 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14460 CHECK_ACCESS(ret_ptr);
14461 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
14463 if (get_jenv_res == JNI_EDETACHED) {
14464 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14468 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
14469 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14471 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14472 if (get_jenv_res == JNI_EDETACHED) {
14473 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14475 DO_ASSERT(get_jenv_res == JNI_OK);
14477 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14478 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14479 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14480 CHECK(obj != NULL);
14481 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
14482 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14483 (*env)->ExceptionDescribe(env);
14484 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
14486 if (get_jenv_res == JNI_EDETACHED) {
14487 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14490 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
14491 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
14492 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14494 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
14495 jclass c = (*env)->GetObjectClass(env, o);
14497 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
14498 atomic_init(&calls->refcnt, 1);
14499 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14500 calls->o = (*env)->NewWeakGlobalRef(env, o);
14501 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
14502 CHECK(calls->node_id_meth != NULL);
14503 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
14504 CHECK(calls->first_hops_meth != NULL);
14505 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
14506 CHECK(calls->send_payment_meth != NULL);
14507 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
14508 CHECK(calls->send_spontaneous_payment_meth != NULL);
14509 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
14510 CHECK(calls->retry_payment_meth != NULL);
14511 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
14512 CHECK(calls->abandon_payment_meth != NULL);
14515 .this_arg = (void*) calls,
14516 .node_id = node_id_LDKPayer_jcall,
14517 .first_hops = first_hops_LDKPayer_jcall,
14518 .send_payment = send_payment_LDKPayer_jcall,
14519 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
14520 .retry_payment = retry_payment_LDKPayer_jcall,
14521 .abandon_payment = abandon_payment_LDKPayer_jcall,
14522 .free = LDKPayer_JCalls_free,
14526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
14527 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
14528 *res_ptr = LDKPayer_init(env, clz, o);
14529 return (uint64_t)res_ptr;
14531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14532 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14533 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14534 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14535 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14536 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
14540 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
14541 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14542 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14543 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14544 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
14545 int64_tArray ret_arr = NULL;
14546 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14547 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14548 for (size_t q = 0; q < ret_var.datalen; q++) {
14549 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14550 int64_t ret_conv_16_ref = 0;
14551 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14552 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
14554 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
14555 if (ret_conv_16_var.is_owned) {
14556 ret_conv_16_ref |= 1;
14558 ret_arr_ptr[q] = ret_conv_16_ref;
14560 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14561 FREE(ret_var.data);
14565 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) {
14566 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14567 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14568 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14569 LDKRoute route_conv;
14570 route_conv.inner = (void*)(route & (~1));
14571 route_conv.is_owned = false;
14572 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14573 LDKThirtyTwoBytes payment_hash_ref;
14574 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14575 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14576 LDKThirtyTwoBytes payment_secret_ref;
14577 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14578 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14579 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14580 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
14581 return (int64_t)ret_conv;
14584 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) {
14585 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14586 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14587 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14588 LDKRoute route_conv;
14589 route_conv.inner = (void*)(route & (~1));
14590 route_conv.is_owned = false;
14591 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14592 LDKThirtyTwoBytes payment_preimage_ref;
14593 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14594 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14595 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14596 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
14597 return (int64_t)ret_conv;
14600 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) {
14601 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14602 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14603 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14604 LDKRoute route_conv;
14605 route_conv.inner = (void*)(route & (~1));
14606 route_conv.is_owned = false;
14607 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14608 LDKThirtyTwoBytes payment_id_ref;
14609 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14610 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14611 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14612 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
14613 return (int64_t)ret_conv;
14616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
14617 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14618 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14619 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14620 LDKThirtyTwoBytes payment_id_ref;
14621 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14622 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14623 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
14626 typedef struct LDKRouter_JCalls {
14627 atomic_size_t refcnt;
14630 jmethodID find_route_meth;
14631 } LDKRouter_JCalls;
14632 static void LDKRouter_JCalls_free(void* this_arg) {
14633 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14634 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14637 if (get_jenv_res == JNI_EDETACHED) {
14638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14640 DO_ASSERT(get_jenv_res == JNI_OK);
14642 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14643 if (get_jenv_res == JNI_EDETACHED) {
14644 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14649 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) {
14650 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14652 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14653 if (get_jenv_res == JNI_EDETACHED) {
14654 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14656 DO_ASSERT(get_jenv_res == JNI_OK);
14658 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
14659 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
14660 LDKRouteParameters route_params_var = *route_params;
14661 int64_t route_params_ref = 0;
14662 route_params_var = RouteParameters_clone(&route_params_var);
14663 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14664 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14665 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
14666 route_params_ref = (uintptr_t)route_params_var.inner;
14667 if (route_params_var.is_owned) {
14668 route_params_ref |= 1;
14670 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14671 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
14672 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
14673 int64_tArray first_hops_arr = NULL;
14674 if (first_hops != NULL) {
14675 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
14676 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
14677 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
14678 for (size_t q = 0; q < first_hops_var.datalen; q++) {
14679 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
14680 int64_t first_hops_conv_16_ref = 0;
14681 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14682 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14683 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
14684 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
14685 if (first_hops_conv_16_var.is_owned) {
14686 first_hops_conv_16_ref |= 1;
14688 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
14690 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
14692 // WARNING: This object doesn't live past this scope, needs clone!
14693 int64_t ret_scorer = ((uintptr_t)scorer) | 1;
14694 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14695 CHECK(obj != NULL);
14696 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);
14697 if (UNLIKELY((*env)->ExceptionCheck(env))) {
14698 (*env)->ExceptionDescribe(env);
14699 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
14701 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
14702 CHECK_ACCESS(ret_ptr);
14703 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
14705 if (get_jenv_res == JNI_EDETACHED) {
14706 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14710 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
14711 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
14712 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14714 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
14715 jclass c = (*env)->GetObjectClass(env, o);
14717 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
14718 atomic_init(&calls->refcnt, 1);
14719 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14720 calls->o = (*env)->NewWeakGlobalRef(env, o);
14721 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
14722 CHECK(calls->find_route_meth != NULL);
14725 .this_arg = (void*) calls,
14726 .find_route = find_route_LDKRouter_jcall,
14727 .free = LDKRouter_JCalls_free,
14731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
14732 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
14733 *res_ptr = LDKRouter_init(env, clz, o);
14734 return (uint64_t)res_ptr;
14736 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) {
14737 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14738 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14739 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14740 LDKPublicKey payer_ref;
14741 CHECK((*env)->GetArrayLength(env, payer) == 33);
14742 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
14743 LDKRouteParameters route_params_conv;
14744 route_params_conv.inner = (void*)(route_params & (~1));
14745 route_params_conv.is_owned = false;
14746 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
14747 unsigned char payment_hash_arr[32];
14748 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14749 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
14750 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14751 LDKCVec_ChannelDetailsZ first_hops_constr;
14752 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
14753 if (first_hops != NULL) {
14754 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
14755 if (first_hops_constr.datalen > 0)
14756 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14758 first_hops_constr.data = NULL;
14759 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
14760 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14761 int64_t first_hops_conv_16 = first_hops_vals[q];
14762 LDKChannelDetails first_hops_conv_16_conv;
14763 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
14764 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
14765 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
14766 first_hops_constr.data[q] = first_hops_conv_16_conv;
14768 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
14769 first_hops_ptr = &first_hops_constr;
14771 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
14772 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
14773 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
14774 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14775 *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);
14776 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
14777 return (int64_t)ret_conv;
14780 static jclass LDKRetry_Attempts_class = NULL;
14781 static jmethodID LDKRetry_Attempts_meth = NULL;
14782 static jclass LDKRetry_Timeout_class = NULL;
14783 static jmethodID LDKRetry_Timeout_meth = NULL;
14784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
14785 LDKRetry_Attempts_class =
14786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
14787 CHECK(LDKRetry_Attempts_class != NULL);
14788 LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
14789 CHECK(LDKRetry_Attempts_meth != NULL);
14790 LDKRetry_Timeout_class =
14791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
14792 CHECK(LDKRetry_Timeout_class != NULL);
14793 LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
14794 CHECK(LDKRetry_Timeout_meth != NULL);
14796 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14797 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
14799 case LDKRetry_Attempts: {
14800 int64_t attempts_conv = obj->attempts;
14801 return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
14803 case LDKRetry_Timeout: {
14804 int64_t timeout_conv = obj->timeout;
14805 return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
14810 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14811 LDKStr ret_str = _ldk_get_compiled_version();
14812 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14817 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14818 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14819 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14824 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14825 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14826 *ret_copy = Bech32Error_clone(arg);
14827 int64_t ret_ref = (uintptr_t)ret_copy;
14830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14831 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
14832 int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
14836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14837 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
14838 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14839 *ret_copy = Bech32Error_clone(orig_conv);
14840 int64_t ret_ref = (uintptr_t)ret_copy;
14844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
14845 if ((o & 1) != 0) return;
14846 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14847 CHECK_ACCESS(o_ptr);
14848 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14850 Bech32Error_free(o_conv);
14853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
14854 LDKTransaction _res_ref;
14855 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
14856 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14857 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
14858 _res_ref.data_is_owned = true;
14859 Transaction_free(_res_ref);
14862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
14863 LDKCVec_u8Z script_pubkey_ref;
14864 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14865 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14866 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
14867 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14868 *ret_ref = TxOut_new(script_pubkey_ref, value);
14869 return (int64_t)ret_ref;
14872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
14873 if ((_res & 1) != 0) return;
14874 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14875 CHECK_ACCESS(_res_ptr);
14876 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14878 TxOut_free(_res_conv);
14881 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14882 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14883 *ret_ref = TxOut_clone(arg);
14884 return (int64_t)ret_ref;
14886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14887 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
14888 int64_t ret_conv = TxOut_clone_ptr(arg_conv);
14892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14893 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
14894 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14895 *ret_ref = TxOut_clone(orig_conv);
14896 return (int64_t)ret_ref;
14899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
14900 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
14905 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14906 *ret_conv = CResult_NoneNoneZ_ok();
14907 return (int64_t)ret_conv;
14910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
14911 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14912 *ret_conv = CResult_NoneNoneZ_err();
14913 return (int64_t)ret_conv;
14916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14917 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
14918 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
14922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14923 if ((_res & 1) != 0) return;
14924 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14925 CHECK_ACCESS(_res_ptr);
14926 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14928 CResult_NoneNoneZ_free(_res_conv);
14931 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14932 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14933 *ret_conv = CResult_NoneNoneZ_clone(arg);
14934 return (int64_t)ret_conv;
14936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14937 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
14938 int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
14942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14943 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
14944 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14945 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14946 return (int64_t)ret_conv;
14949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14950 LDKCounterpartyCommitmentSecrets o_conv;
14951 o_conv.inner = (void*)(o & (~1));
14952 o_conv.is_owned = (o & 1) || (o == 0);
14953 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14954 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14955 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14956 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14957 return (int64_t)ret_conv;
14960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14961 LDKDecodeError e_conv;
14962 e_conv.inner = (void*)(e & (~1));
14963 e_conv.is_owned = (e & 1) || (e == 0);
14964 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14965 e_conv = DecodeError_clone(&e_conv);
14966 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14967 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14968 return (int64_t)ret_conv;
14971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14972 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
14973 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14978 if ((_res & 1) != 0) return;
14979 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14980 CHECK_ACCESS(_res_ptr);
14981 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14983 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14986 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14987 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14988 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14989 return (int64_t)ret_conv;
14991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14992 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
14993 int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14998 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
14999 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
15000 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
15001 return (int64_t)ret_conv;
15004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15005 LDKSecretKey o_ref;
15006 CHECK((*env)->GetArrayLength(env, o) == 32);
15007 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
15008 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15009 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
15010 return (int64_t)ret_conv;
15013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15014 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15015 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15016 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
15017 return (int64_t)ret_conv;
15020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15021 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
15022 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
15026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15027 if ((_res & 1) != 0) return;
15028 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15029 CHECK_ACCESS(_res_ptr);
15030 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
15032 CResult_SecretKeyErrorZ_free(_res_conv);
15035 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
15036 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15037 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
15038 return (int64_t)ret_conv;
15040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15041 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
15042 int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
15046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15047 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
15048 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15049 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
15050 return (int64_t)ret_conv;
15053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15054 LDKPublicKey o_ref;
15055 CHECK((*env)->GetArrayLength(env, o) == 33);
15056 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
15057 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15058 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
15059 return (int64_t)ret_conv;
15062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15063 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15064 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15065 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
15066 return (int64_t)ret_conv;
15069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15070 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
15071 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
15075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15076 if ((_res & 1) != 0) return;
15077 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15078 CHECK_ACCESS(_res_ptr);
15079 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
15081 CResult_PublicKeyErrorZ_free(_res_conv);
15084 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
15085 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15086 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
15087 return (int64_t)ret_conv;
15089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15090 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
15091 int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
15095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15096 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
15097 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15098 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
15099 return (int64_t)ret_conv;
15102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15103 LDKTxCreationKeys o_conv;
15104 o_conv.inner = (void*)(o & (~1));
15105 o_conv.is_owned = (o & 1) || (o == 0);
15106 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15107 o_conv = TxCreationKeys_clone(&o_conv);
15108 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15109 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
15110 return (int64_t)ret_conv;
15113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15114 LDKDecodeError e_conv;
15115 e_conv.inner = (void*)(e & (~1));
15116 e_conv.is_owned = (e & 1) || (e == 0);
15117 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15118 e_conv = DecodeError_clone(&e_conv);
15119 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15120 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
15121 return (int64_t)ret_conv;
15124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15125 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
15126 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
15130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15131 if ((_res & 1) != 0) return;
15132 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15133 CHECK_ACCESS(_res_ptr);
15134 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
15136 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
15139 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
15140 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15141 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
15142 return (int64_t)ret_conv;
15144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15145 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
15146 int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
15150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15151 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
15152 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15153 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
15154 return (int64_t)ret_conv;
15157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15158 LDKChannelPublicKeys o_conv;
15159 o_conv.inner = (void*)(o & (~1));
15160 o_conv.is_owned = (o & 1) || (o == 0);
15161 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15162 o_conv = ChannelPublicKeys_clone(&o_conv);
15163 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15164 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
15165 return (int64_t)ret_conv;
15168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15169 LDKDecodeError e_conv;
15170 e_conv.inner = (void*)(e & (~1));
15171 e_conv.is_owned = (e & 1) || (e == 0);
15172 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15173 e_conv = DecodeError_clone(&e_conv);
15174 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15175 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
15176 return (int64_t)ret_conv;
15179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15180 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
15181 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
15185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15186 if ((_res & 1) != 0) return;
15187 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15188 CHECK_ACCESS(_res_ptr);
15189 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
15191 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
15194 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
15195 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15196 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
15197 return (int64_t)ret_conv;
15199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15200 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
15201 int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
15205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15206 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
15207 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15208 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
15209 return (int64_t)ret_conv;
15212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15213 LDKTxCreationKeys o_conv;
15214 o_conv.inner = (void*)(o & (~1));
15215 o_conv.is_owned = (o & 1) || (o == 0);
15216 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15217 o_conv = TxCreationKeys_clone(&o_conv);
15218 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15219 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
15220 return (int64_t)ret_conv;
15223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15224 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15225 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15226 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
15227 return (int64_t)ret_conv;
15230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15231 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
15232 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
15236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15237 if ((_res & 1) != 0) return;
15238 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15239 CHECK_ACCESS(_res_ptr);
15240 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
15242 CResult_TxCreationKeysErrorZ_free(_res_conv);
15245 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
15246 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15247 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
15248 return (int64_t)ret_conv;
15250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15251 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
15252 int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
15256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15257 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
15258 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15259 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
15260 return (int64_t)ret_conv;
15263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
15264 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15265 *ret_copy = COption_u32Z_some(o);
15266 int64_t ret_ref = (uintptr_t)ret_copy;
15270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
15271 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15272 *ret_copy = COption_u32Z_none();
15273 int64_t ret_ref = (uintptr_t)ret_copy;
15277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15278 if ((_res & 1) != 0) return;
15279 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15280 CHECK_ACCESS(_res_ptr);
15281 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
15283 COption_u32Z_free(_res_conv);
15286 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
15287 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15288 *ret_copy = COption_u32Z_clone(arg);
15289 int64_t ret_ref = (uintptr_t)ret_copy;
15292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15293 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
15294 int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
15298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15299 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
15300 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15301 *ret_copy = COption_u32Z_clone(orig_conv);
15302 int64_t ret_ref = (uintptr_t)ret_copy;
15306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15307 LDKHTLCOutputInCommitment o_conv;
15308 o_conv.inner = (void*)(o & (~1));
15309 o_conv.is_owned = (o & 1) || (o == 0);
15310 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15311 o_conv = HTLCOutputInCommitment_clone(&o_conv);
15312 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15313 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
15314 return (int64_t)ret_conv;
15317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15318 LDKDecodeError e_conv;
15319 e_conv.inner = (void*)(e & (~1));
15320 e_conv.is_owned = (e & 1) || (e == 0);
15321 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15322 e_conv = DecodeError_clone(&e_conv);
15323 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15324 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
15325 return (int64_t)ret_conv;
15328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15329 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
15330 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
15334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15335 if ((_res & 1) != 0) return;
15336 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15337 CHECK_ACCESS(_res_ptr);
15338 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
15340 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
15343 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
15344 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15345 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
15346 return (int64_t)ret_conv;
15348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15349 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
15350 int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
15354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15355 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
15356 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15357 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
15358 return (int64_t)ret_conv;
15361 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
15362 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
15366 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
15367 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
15371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
15372 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
15373 COption_NoneZ_free(_res_conv);
15376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15377 LDKCounterpartyChannelTransactionParameters o_conv;
15378 o_conv.inner = (void*)(o & (~1));
15379 o_conv.is_owned = (o & 1) || (o == 0);
15380 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15381 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
15382 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15383 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15384 return (int64_t)ret_conv;
15387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15388 LDKDecodeError e_conv;
15389 e_conv.inner = (void*)(e & (~1));
15390 e_conv.is_owned = (e & 1) || (e == 0);
15391 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15392 e_conv = DecodeError_clone(&e_conv);
15393 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15394 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
15395 return (int64_t)ret_conv;
15398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15399 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
15400 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15405 if ((_res & 1) != 0) return;
15406 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15407 CHECK_ACCESS(_res_ptr);
15408 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15410 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15413 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15414 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15415 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
15416 return (int64_t)ret_conv;
15418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15419 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
15420 int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15425 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
15426 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15427 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15428 return (int64_t)ret_conv;
15431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15432 LDKChannelTransactionParameters o_conv;
15433 o_conv.inner = (void*)(o & (~1));
15434 o_conv.is_owned = (o & 1) || (o == 0);
15435 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15436 o_conv = ChannelTransactionParameters_clone(&o_conv);
15437 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15438 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15439 return (int64_t)ret_conv;
15442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15443 LDKDecodeError e_conv;
15444 e_conv.inner = (void*)(e & (~1));
15445 e_conv.is_owned = (e & 1) || (e == 0);
15446 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15447 e_conv = DecodeError_clone(&e_conv);
15448 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15449 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
15450 return (int64_t)ret_conv;
15453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15454 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
15455 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15460 if ((_res & 1) != 0) return;
15461 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15462 CHECK_ACCESS(_res_ptr);
15463 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15465 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15468 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15469 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15470 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
15471 return (int64_t)ret_conv;
15473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15474 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
15475 int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15480 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
15481 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15482 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15483 return (int64_t)ret_conv;
15486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15487 LDKCVec_SignatureZ _res_constr;
15488 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15489 if (_res_constr.datalen > 0)
15490 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15492 _res_constr.data = NULL;
15493 for (size_t i = 0; i < _res_constr.datalen; i++) {
15494 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15495 LDKSignature _res_conv_8_ref;
15496 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
15497 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
15498 _res_constr.data[i] = _res_conv_8_ref;
15500 CVec_SignatureZ_free(_res_constr);
15503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15504 LDKHolderCommitmentTransaction o_conv;
15505 o_conv.inner = (void*)(o & (~1));
15506 o_conv.is_owned = (o & 1) || (o == 0);
15507 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15508 o_conv = HolderCommitmentTransaction_clone(&o_conv);
15509 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15510 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
15511 return (int64_t)ret_conv;
15514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15515 LDKDecodeError e_conv;
15516 e_conv.inner = (void*)(e & (~1));
15517 e_conv.is_owned = (e & 1) || (e == 0);
15518 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15519 e_conv = DecodeError_clone(&e_conv);
15520 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15521 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
15522 return (int64_t)ret_conv;
15525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15526 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
15527 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15532 if ((_res & 1) != 0) return;
15533 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15534 CHECK_ACCESS(_res_ptr);
15535 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15537 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
15540 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15541 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15542 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
15543 return (int64_t)ret_conv;
15545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15546 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15547 int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15552 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15553 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15554 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15555 return (int64_t)ret_conv;
15558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15559 LDKBuiltCommitmentTransaction o_conv;
15560 o_conv.inner = (void*)(o & (~1));
15561 o_conv.is_owned = (o & 1) || (o == 0);
15562 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15563 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
15564 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15565 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
15566 return (int64_t)ret_conv;
15569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15570 LDKDecodeError e_conv;
15571 e_conv.inner = (void*)(e & (~1));
15572 e_conv.is_owned = (e & 1) || (e == 0);
15573 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15574 e_conv = DecodeError_clone(&e_conv);
15575 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15576 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
15577 return (int64_t)ret_conv;
15580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15581 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
15582 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15587 if ((_res & 1) != 0) return;
15588 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15589 CHECK_ACCESS(_res_ptr);
15590 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15592 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
15595 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15596 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15597 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
15598 return (int64_t)ret_conv;
15600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15601 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
15602 int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15607 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
15608 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15609 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15610 return (int64_t)ret_conv;
15613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15614 LDKTrustedClosingTransaction o_conv;
15615 o_conv.inner = (void*)(o & (~1));
15616 o_conv.is_owned = (o & 1) || (o == 0);
15617 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15618 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
15619 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15620 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
15621 return (int64_t)ret_conv;
15624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15625 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15626 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
15627 return (int64_t)ret_conv;
15630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15631 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
15632 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
15636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15637 if ((_res & 1) != 0) return;
15638 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15639 CHECK_ACCESS(_res_ptr);
15640 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
15642 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
15645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15646 LDKCommitmentTransaction o_conv;
15647 o_conv.inner = (void*)(o & (~1));
15648 o_conv.is_owned = (o & 1) || (o == 0);
15649 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15650 o_conv = CommitmentTransaction_clone(&o_conv);
15651 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15652 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
15653 return (int64_t)ret_conv;
15656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15657 LDKDecodeError e_conv;
15658 e_conv.inner = (void*)(e & (~1));
15659 e_conv.is_owned = (e & 1) || (e == 0);
15660 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15661 e_conv = DecodeError_clone(&e_conv);
15662 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15663 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
15664 return (int64_t)ret_conv;
15667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15668 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
15669 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15674 if ((_res & 1) != 0) return;
15675 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15676 CHECK_ACCESS(_res_ptr);
15677 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
15679 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
15682 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15683 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15684 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
15685 return (int64_t)ret_conv;
15687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15688 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
15689 int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15694 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
15695 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15696 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
15697 return (int64_t)ret_conv;
15700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15701 LDKTrustedCommitmentTransaction o_conv;
15702 o_conv.inner = (void*)(o & (~1));
15703 o_conv.is_owned = (o & 1) || (o == 0);
15704 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15705 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
15706 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15707 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
15708 return (int64_t)ret_conv;
15711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15712 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15713 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
15714 return (int64_t)ret_conv;
15717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15718 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
15719 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
15723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15724 if ((_res & 1) != 0) return;
15725 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15726 CHECK_ACCESS(_res_ptr);
15727 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
15729 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
15732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
15733 LDKCVec_SignatureZ o_constr;
15734 o_constr.datalen = (*env)->GetArrayLength(env, o);
15735 if (o_constr.datalen > 0)
15736 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15738 o_constr.data = NULL;
15739 for (size_t i = 0; i < o_constr.datalen; i++) {
15740 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
15741 LDKSignature o_conv_8_ref;
15742 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
15743 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
15744 o_constr.data[i] = o_conv_8_ref;
15746 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15747 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
15748 return (int64_t)ret_conv;
15751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
15752 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15753 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
15754 return (int64_t)ret_conv;
15757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15758 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
15759 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
15763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15764 if ((_res & 1) != 0) return;
15765 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15766 CHECK_ACCESS(_res_ptr);
15767 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
15769 CResult_CVec_SignatureZNoneZ_free(_res_conv);
15772 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
15773 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15774 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
15775 return (int64_t)ret_conv;
15777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15778 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
15779 int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
15783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15784 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
15785 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15786 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
15787 return (int64_t)ret_conv;
15790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15791 LDKShutdownScript o_conv;
15792 o_conv.inner = (void*)(o & (~1));
15793 o_conv.is_owned = (o & 1) || (o == 0);
15794 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15795 o_conv = ShutdownScript_clone(&o_conv);
15796 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15797 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
15798 return (int64_t)ret_conv;
15801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15802 LDKDecodeError e_conv;
15803 e_conv.inner = (void*)(e & (~1));
15804 e_conv.is_owned = (e & 1) || (e == 0);
15805 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15806 e_conv = DecodeError_clone(&e_conv);
15807 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15808 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15809 return (int64_t)ret_conv;
15812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15813 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
15814 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15819 if ((_res & 1) != 0) return;
15820 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15821 CHECK_ACCESS(_res_ptr);
15822 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15824 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15827 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15828 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15829 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15830 return (int64_t)ret_conv;
15832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15833 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
15834 int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15839 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
15840 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15841 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15842 return (int64_t)ret_conv;
15845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15846 LDKShutdownScript o_conv;
15847 o_conv.inner = (void*)(o & (~1));
15848 o_conv.is_owned = (o & 1) || (o == 0);
15849 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15850 o_conv = ShutdownScript_clone(&o_conv);
15851 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15852 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15853 return (int64_t)ret_conv;
15856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15857 LDKInvalidShutdownScript e_conv;
15858 e_conv.inner = (void*)(e & (~1));
15859 e_conv.is_owned = (e & 1) || (e == 0);
15860 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15861 e_conv = InvalidShutdownScript_clone(&e_conv);
15862 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15863 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15864 return (int64_t)ret_conv;
15867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15868 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
15869 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15874 if ((_res & 1) != 0) return;
15875 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15876 CHECK_ACCESS(_res_ptr);
15877 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15879 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15882 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15883 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15884 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15885 return (int64_t)ret_conv;
15887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15888 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
15889 int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15894 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
15895 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15896 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15897 return (int64_t)ret_conv;
15900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
15901 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15902 *ret_conv = CResult_NoneErrorZ_ok();
15903 return (int64_t)ret_conv;
15906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15907 LDKIOError e_conv = LDKIOError_from_java(env, e);
15908 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15909 *ret_conv = CResult_NoneErrorZ_err(e_conv);
15910 return (int64_t)ret_conv;
15913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15914 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
15915 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
15919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15920 if ((_res & 1) != 0) return;
15921 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15922 CHECK_ACCESS(_res_ptr);
15923 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
15925 CResult_NoneErrorZ_free(_res_conv);
15928 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
15929 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15930 *ret_conv = CResult_NoneErrorZ_clone(arg);
15931 return (int64_t)ret_conv;
15933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15934 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
15935 int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
15939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15940 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
15941 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15942 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
15943 return (int64_t)ret_conv;
15946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15947 LDKRouteHop o_conv;
15948 o_conv.inner = (void*)(o & (~1));
15949 o_conv.is_owned = (o & 1) || (o == 0);
15950 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15951 o_conv = RouteHop_clone(&o_conv);
15952 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15953 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
15954 return (int64_t)ret_conv;
15957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15958 LDKDecodeError e_conv;
15959 e_conv.inner = (void*)(e & (~1));
15960 e_conv.is_owned = (e & 1) || (e == 0);
15961 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15962 e_conv = DecodeError_clone(&e_conv);
15963 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15964 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
15965 return (int64_t)ret_conv;
15968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15969 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
15970 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
15974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15975 if ((_res & 1) != 0) return;
15976 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15977 CHECK_ACCESS(_res_ptr);
15978 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
15980 CResult_RouteHopDecodeErrorZ_free(_res_conv);
15983 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
15984 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15985 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
15986 return (int64_t)ret_conv;
15988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15989 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
15990 int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
15994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15995 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
15996 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15997 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
15998 return (int64_t)ret_conv;
16001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16002 LDKCVec_RouteHopZ _res_constr;
16003 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16004 if (_res_constr.datalen > 0)
16005 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16007 _res_constr.data = NULL;
16008 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16009 for (size_t k = 0; k < _res_constr.datalen; k++) {
16010 int64_t _res_conv_10 = _res_vals[k];
16011 LDKRouteHop _res_conv_10_conv;
16012 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
16013 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
16014 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
16015 _res_constr.data[k] = _res_conv_10_conv;
16017 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16018 CVec_RouteHopZ_free(_res_constr);
16021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16022 LDKCVec_CVec_RouteHopZZ _res_constr;
16023 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16024 if (_res_constr.datalen > 0)
16025 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
16027 _res_constr.data = NULL;
16028 for (size_t m = 0; m < _res_constr.datalen; m++) {
16029 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
16030 LDKCVec_RouteHopZ _res_conv_12_constr;
16031 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
16032 if (_res_conv_12_constr.datalen > 0)
16033 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16035 _res_conv_12_constr.data = NULL;
16036 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
16037 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
16038 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
16039 LDKRouteHop _res_conv_12_conv_10_conv;
16040 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
16041 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
16042 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
16043 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
16045 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
16046 _res_constr.data[m] = _res_conv_12_constr;
16048 CVec_CVec_RouteHopZZ_free(_res_constr);
16051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16053 o_conv.inner = (void*)(o & (~1));
16054 o_conv.is_owned = (o & 1) || (o == 0);
16055 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16056 o_conv = Route_clone(&o_conv);
16057 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16058 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
16059 return (int64_t)ret_conv;
16062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16063 LDKDecodeError e_conv;
16064 e_conv.inner = (void*)(e & (~1));
16065 e_conv.is_owned = (e & 1) || (e == 0);
16066 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16067 e_conv = DecodeError_clone(&e_conv);
16068 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16069 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
16070 return (int64_t)ret_conv;
16073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16074 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
16075 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
16079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16080 if ((_res & 1) != 0) return;
16081 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16082 CHECK_ACCESS(_res_ptr);
16083 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
16085 CResult_RouteDecodeErrorZ_free(_res_conv);
16088 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
16089 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16090 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
16091 return (int64_t)ret_conv;
16093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16094 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
16095 int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
16099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16100 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
16101 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16102 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
16103 return (int64_t)ret_conv;
16106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16107 LDKRouteParameters o_conv;
16108 o_conv.inner = (void*)(o & (~1));
16109 o_conv.is_owned = (o & 1) || (o == 0);
16110 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16111 o_conv = RouteParameters_clone(&o_conv);
16112 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16113 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
16114 return (int64_t)ret_conv;
16117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16118 LDKDecodeError e_conv;
16119 e_conv.inner = (void*)(e & (~1));
16120 e_conv.is_owned = (e & 1) || (e == 0);
16121 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16122 e_conv = DecodeError_clone(&e_conv);
16123 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16124 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
16125 return (int64_t)ret_conv;
16128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16129 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
16130 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
16134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16135 if ((_res & 1) != 0) return;
16136 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16137 CHECK_ACCESS(_res_ptr);
16138 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
16140 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
16143 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
16144 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16145 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
16146 return (int64_t)ret_conv;
16148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16149 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
16150 int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
16154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16155 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
16156 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16157 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
16158 return (int64_t)ret_conv;
16161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16162 LDKCVec_RouteHintZ _res_constr;
16163 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16164 if (_res_constr.datalen > 0)
16165 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16167 _res_constr.data = NULL;
16168 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16169 for (size_t l = 0; l < _res_constr.datalen; l++) {
16170 int64_t _res_conv_11 = _res_vals[l];
16171 LDKRouteHint _res_conv_11_conv;
16172 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
16173 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
16174 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
16175 _res_constr.data[l] = _res_conv_11_conv;
16177 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16178 CVec_RouteHintZ_free(_res_constr);
16181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
16182 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16183 *ret_copy = COption_u64Z_some(o);
16184 int64_t ret_ref = (uintptr_t)ret_copy;
16188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
16189 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16190 *ret_copy = COption_u64Z_none();
16191 int64_t ret_ref = (uintptr_t)ret_copy;
16195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16196 if ((_res & 1) != 0) return;
16197 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16198 CHECK_ACCESS(_res_ptr);
16199 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
16201 COption_u64Z_free(_res_conv);
16204 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
16205 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16206 *ret_copy = COption_u64Z_clone(arg);
16207 int64_t ret_ref = (uintptr_t)ret_copy;
16210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16211 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
16212 int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
16216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16217 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
16218 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16219 *ret_copy = COption_u64Z_clone(orig_conv);
16220 int64_t ret_ref = (uintptr_t)ret_copy;
16224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16225 LDKCVec_u64Z _res_constr;
16226 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16227 if (_res_constr.datalen > 0)
16228 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16230 _res_constr.data = NULL;
16231 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16232 for (size_t g = 0; g < _res_constr.datalen; g++) {
16233 int64_t _res_conv_6 = _res_vals[g];
16234 _res_constr.data[g] = _res_conv_6;
16236 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16237 CVec_u64Z_free(_res_constr);
16240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16241 LDKPaymentParameters o_conv;
16242 o_conv.inner = (void*)(o & (~1));
16243 o_conv.is_owned = (o & 1) || (o == 0);
16244 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16245 o_conv = PaymentParameters_clone(&o_conv);
16246 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16247 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
16248 return (int64_t)ret_conv;
16251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16252 LDKDecodeError e_conv;
16253 e_conv.inner = (void*)(e & (~1));
16254 e_conv.is_owned = (e & 1) || (e == 0);
16255 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16256 e_conv = DecodeError_clone(&e_conv);
16257 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16258 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
16259 return (int64_t)ret_conv;
16262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16263 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
16264 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
16268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16269 if ((_res & 1) != 0) return;
16270 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16271 CHECK_ACCESS(_res_ptr);
16272 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
16274 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
16277 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
16278 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16279 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
16280 return (int64_t)ret_conv;
16282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16283 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
16284 int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
16288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16289 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
16290 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16291 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
16292 return (int64_t)ret_conv;
16295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16296 LDKCVec_RouteHintHopZ _res_constr;
16297 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16298 if (_res_constr.datalen > 0)
16299 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
16301 _res_constr.data = NULL;
16302 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16303 for (size_t o = 0; o < _res_constr.datalen; o++) {
16304 int64_t _res_conv_14 = _res_vals[o];
16305 LDKRouteHintHop _res_conv_14_conv;
16306 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
16307 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
16308 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16309 _res_constr.data[o] = _res_conv_14_conv;
16311 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16312 CVec_RouteHintHopZ_free(_res_constr);
16315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16316 LDKRouteHint o_conv;
16317 o_conv.inner = (void*)(o & (~1));
16318 o_conv.is_owned = (o & 1) || (o == 0);
16319 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16320 o_conv = RouteHint_clone(&o_conv);
16321 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16322 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
16323 return (int64_t)ret_conv;
16326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16327 LDKDecodeError e_conv;
16328 e_conv.inner = (void*)(e & (~1));
16329 e_conv.is_owned = (e & 1) || (e == 0);
16330 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16331 e_conv = DecodeError_clone(&e_conv);
16332 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16333 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
16334 return (int64_t)ret_conv;
16337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16338 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
16339 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
16343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16344 if ((_res & 1) != 0) return;
16345 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16346 CHECK_ACCESS(_res_ptr);
16347 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
16349 CResult_RouteHintDecodeErrorZ_free(_res_conv);
16352 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
16353 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16354 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
16355 return (int64_t)ret_conv;
16357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16358 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
16359 int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
16363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16364 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
16365 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16366 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
16367 return (int64_t)ret_conv;
16370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16371 LDKRouteHintHop o_conv;
16372 o_conv.inner = (void*)(o & (~1));
16373 o_conv.is_owned = (o & 1) || (o == 0);
16374 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16375 o_conv = RouteHintHop_clone(&o_conv);
16376 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16377 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
16378 return (int64_t)ret_conv;
16381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16382 LDKDecodeError e_conv;
16383 e_conv.inner = (void*)(e & (~1));
16384 e_conv.is_owned = (e & 1) || (e == 0);
16385 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16386 e_conv = DecodeError_clone(&e_conv);
16387 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16388 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
16389 return (int64_t)ret_conv;
16392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16393 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
16394 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
16398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16399 if ((_res & 1) != 0) return;
16400 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16401 CHECK_ACCESS(_res_ptr);
16402 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
16404 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
16407 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
16408 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16409 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
16410 return (int64_t)ret_conv;
16412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16413 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
16414 int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
16418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16419 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
16420 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16421 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
16422 return (int64_t)ret_conv;
16425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16426 LDKCVec_ChannelDetailsZ _res_constr;
16427 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16428 if (_res_constr.datalen > 0)
16429 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16431 _res_constr.data = NULL;
16432 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16433 for (size_t q = 0; q < _res_constr.datalen; q++) {
16434 int64_t _res_conv_16 = _res_vals[q];
16435 LDKChannelDetails _res_conv_16_conv;
16436 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16437 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16438 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16439 _res_constr.data[q] = _res_conv_16_conv;
16441 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16442 CVec_ChannelDetailsZ_free(_res_constr);
16445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16447 o_conv.inner = (void*)(o & (~1));
16448 o_conv.is_owned = (o & 1) || (o == 0);
16449 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16450 o_conv = Route_clone(&o_conv);
16451 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16452 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
16453 return (int64_t)ret_conv;
16456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16457 LDKLightningError e_conv;
16458 e_conv.inner = (void*)(e & (~1));
16459 e_conv.is_owned = (e & 1) || (e == 0);
16460 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16461 e_conv = LightningError_clone(&e_conv);
16462 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16463 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
16464 return (int64_t)ret_conv;
16467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16468 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
16469 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
16473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16474 if ((_res & 1) != 0) return;
16475 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16476 CHECK_ACCESS(_res_ptr);
16477 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
16479 CResult_RouteLightningErrorZ_free(_res_conv);
16482 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
16483 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16484 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
16485 return (int64_t)ret_conv;
16487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16488 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
16489 int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
16493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16494 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
16495 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16496 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
16497 return (int64_t)ret_conv;
16500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16501 LDKCVec_PublicKeyZ _res_constr;
16502 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16503 if (_res_constr.datalen > 0)
16504 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
16506 _res_constr.data = NULL;
16507 for (size_t i = 0; i < _res_constr.datalen; i++) {
16508 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16509 LDKPublicKey _res_conv_8_ref;
16510 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
16511 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
16512 _res_constr.data[i] = _res_conv_8_ref;
16514 CVec_PublicKeyZ_free(_res_constr);
16517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16518 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16519 CHECK_ACCESS(o_ptr);
16520 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
16521 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
16522 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16523 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
16524 return (int64_t)ret_conv;
16527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16528 LDKDecodeError e_conv;
16529 e_conv.inner = (void*)(e & (~1));
16530 e_conv.is_owned = (e & 1) || (e == 0);
16531 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16532 e_conv = DecodeError_clone(&e_conv);
16533 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16534 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
16535 return (int64_t)ret_conv;
16538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16539 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
16540 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
16544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16545 if ((_res & 1) != 0) return;
16546 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16547 CHECK_ACCESS(_res_ptr);
16548 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
16550 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
16553 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
16554 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16555 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
16556 return (int64_t)ret_conv;
16558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16559 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
16560 int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
16564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16565 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
16566 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16567 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
16568 return (int64_t)ret_conv;
16571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16572 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16573 CHECK_ACCESS(o_ptr);
16574 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
16575 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
16576 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16577 *ret_copy = COption_ClosureReasonZ_some(o_conv);
16578 int64_t ret_ref = (uintptr_t)ret_copy;
16582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
16583 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16584 *ret_copy = COption_ClosureReasonZ_none();
16585 int64_t ret_ref = (uintptr_t)ret_copy;
16589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16590 if ((_res & 1) != 0) return;
16591 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16592 CHECK_ACCESS(_res_ptr);
16593 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
16595 COption_ClosureReasonZ_free(_res_conv);
16598 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
16599 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16600 *ret_copy = COption_ClosureReasonZ_clone(arg);
16601 int64_t ret_ref = (uintptr_t)ret_copy;
16604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16605 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
16606 int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
16610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16611 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
16612 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16613 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
16614 int64_t ret_ref = (uintptr_t)ret_copy;
16618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16619 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16620 CHECK_ACCESS(o_ptr);
16621 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
16622 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
16623 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16624 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
16625 return (int64_t)ret_conv;
16628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16629 LDKDecodeError e_conv;
16630 e_conv.inner = (void*)(e & (~1));
16631 e_conv.is_owned = (e & 1) || (e == 0);
16632 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16633 e_conv = DecodeError_clone(&e_conv);
16634 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16635 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
16636 return (int64_t)ret_conv;
16639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16640 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
16641 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
16645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16646 if ((_res & 1) != 0) return;
16647 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16648 CHECK_ACCESS(_res_ptr);
16649 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
16651 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
16654 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
16655 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16656 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
16657 return (int64_t)ret_conv;
16659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16660 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
16661 int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
16665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16666 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
16667 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16668 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
16669 return (int64_t)ret_conv;
16672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16673 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16674 CHECK_ACCESS(o_ptr);
16675 LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
16676 o_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)o) & ~1));
16677 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16678 *ret_copy = COption_HTLCDestinationZ_some(o_conv);
16679 int64_t ret_ref = (uintptr_t)ret_copy;
16683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
16684 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16685 *ret_copy = COption_HTLCDestinationZ_none();
16686 int64_t ret_ref = (uintptr_t)ret_copy;
16690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16691 if ((_res & 1) != 0) return;
16692 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16693 CHECK_ACCESS(_res_ptr);
16694 LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
16696 COption_HTLCDestinationZ_free(_res_conv);
16699 static inline uintptr_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
16700 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16701 *ret_copy = COption_HTLCDestinationZ_clone(arg);
16702 int64_t ret_ref = (uintptr_t)ret_copy;
16705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16706 LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)arg;
16707 int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
16711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16712 LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)orig;
16713 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
16714 *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
16715 int64_t ret_ref = (uintptr_t)ret_copy;
16719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16720 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16721 CHECK_ACCESS(o_ptr);
16722 LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
16723 o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)(((uintptr_t)o) & ~1));
16724 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16725 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
16726 return (int64_t)ret_conv;
16729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16730 LDKDecodeError e_conv;
16731 e_conv.inner = (void*)(e & (~1));
16732 e_conv.is_owned = (e & 1) || (e == 0);
16733 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16734 e_conv = DecodeError_clone(&e_conv);
16735 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16736 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
16737 return (int64_t)ret_conv;
16740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16741 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(o & ~1);
16742 jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
16746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16747 if ((_res & 1) != 0) return;
16748 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16749 CHECK_ACCESS(_res_ptr);
16750 LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
16752 CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
16755 static inline uintptr_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
16756 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16757 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
16758 return (int64_t)ret_conv;
16760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16761 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(arg & ~1);
16762 int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
16766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16767 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(orig & ~1);
16768 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
16769 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
16770 return (int64_t)ret_conv;
16773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16774 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16775 CHECK_ACCESS(o_ptr);
16776 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
16777 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
16778 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16779 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
16780 int64_t ret_ref = (uintptr_t)ret_copy;
16784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
16785 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16786 *ret_copy = COption_NetworkUpdateZ_none();
16787 int64_t ret_ref = (uintptr_t)ret_copy;
16791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16792 if ((_res & 1) != 0) return;
16793 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16794 CHECK_ACCESS(_res_ptr);
16795 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
16797 COption_NetworkUpdateZ_free(_res_conv);
16800 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
16801 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16802 *ret_copy = COption_NetworkUpdateZ_clone(arg);
16803 int64_t ret_ref = (uintptr_t)ret_copy;
16806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16807 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
16808 int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
16812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16813 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
16814 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16815 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
16816 int64_t ret_ref = (uintptr_t)ret_copy;
16820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16821 LDKCVec_SpendableOutputDescriptorZ _res_constr;
16822 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16823 if (_res_constr.datalen > 0)
16824 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16826 _res_constr.data = NULL;
16827 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16828 for (size_t b = 0; b < _res_constr.datalen; b++) {
16829 int64_t _res_conv_27 = _res_vals[b];
16830 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
16831 CHECK_ACCESS(_res_conv_27_ptr);
16832 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16833 FREE((void*)_res_conv_27);
16834 _res_constr.data[b] = _res_conv_27_conv;
16836 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16837 CVec_SpendableOutputDescriptorZ_free(_res_constr);
16840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16841 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16842 CHECK_ACCESS(o_ptr);
16843 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
16844 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
16845 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16846 *ret_copy = COption_EventZ_some(o_conv);
16847 int64_t ret_ref = (uintptr_t)ret_copy;
16851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
16852 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16853 *ret_copy = COption_EventZ_none();
16854 int64_t ret_ref = (uintptr_t)ret_copy;
16858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16859 if ((_res & 1) != 0) return;
16860 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16861 CHECK_ACCESS(_res_ptr);
16862 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
16864 COption_EventZ_free(_res_conv);
16867 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
16868 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16869 *ret_copy = COption_EventZ_clone(arg);
16870 int64_t ret_ref = (uintptr_t)ret_copy;
16873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16874 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
16875 int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
16879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16880 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
16881 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16882 *ret_copy = COption_EventZ_clone(orig_conv);
16883 int64_t ret_ref = (uintptr_t)ret_copy;
16887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16888 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16889 CHECK_ACCESS(o_ptr);
16890 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
16891 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
16892 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16893 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
16894 return (int64_t)ret_conv;
16897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16898 LDKDecodeError e_conv;
16899 e_conv.inner = (void*)(e & (~1));
16900 e_conv.is_owned = (e & 1) || (e == 0);
16901 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16902 e_conv = DecodeError_clone(&e_conv);
16903 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16904 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
16905 return (int64_t)ret_conv;
16908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16909 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
16910 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
16914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16915 if ((_res & 1) != 0) return;
16916 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16917 CHECK_ACCESS(_res_ptr);
16918 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
16920 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
16923 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
16924 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16925 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
16926 return (int64_t)ret_conv;
16928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16929 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
16930 int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
16934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16935 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
16936 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16937 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
16938 return (int64_t)ret_conv;
16941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16942 LDKCVec_MessageSendEventZ _res_constr;
16943 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16944 if (_res_constr.datalen > 0)
16945 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16947 _res_constr.data = NULL;
16948 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16949 for (size_t s = 0; s < _res_constr.datalen; s++) {
16950 int64_t _res_conv_18 = _res_vals[s];
16951 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
16952 CHECK_ACCESS(_res_conv_18_ptr);
16953 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
16954 FREE((void*)_res_conv_18);
16955 _res_constr.data[s] = _res_conv_18_conv;
16957 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16958 CVec_MessageSendEventZ_free(_res_constr);
16961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16962 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16963 CHECK_ACCESS(o_ptr);
16964 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
16965 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
16966 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16967 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
16968 return (int64_t)ret_conv;
16971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16972 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
16973 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16974 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
16975 return (int64_t)ret_conv;
16978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16979 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
16980 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
16984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16985 if ((_res & 1) != 0) return;
16986 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16987 CHECK_ACCESS(_res_ptr);
16988 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
16990 CResult_TxOutAccessErrorZ_free(_res_conv);
16993 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
16994 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
16995 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
16996 return (int64_t)ret_conv;
16998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16999 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
17000 int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
17004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17005 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
17006 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
17007 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
17008 return (int64_t)ret_conv;
17011 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
17012 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17013 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
17014 return ((int64_t)ret_conv);
17016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17017 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
17018 int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
17022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17023 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
17024 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17025 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
17026 return ((int64_t)ret_conv);
17029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
17030 LDKTransaction b_ref;
17031 b_ref.datalen = (*env)->GetArrayLength(env, b);
17032 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
17033 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
17034 b_ref.data_is_owned = true;
17035 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17036 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
17037 return ((int64_t)ret_conv);
17040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17041 if ((_res & 1) != 0) return;
17042 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17043 CHECK_ACCESS(_res_ptr);
17044 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
17046 C2Tuple_usizeTransactionZ_free(_res_conv);
17049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17050 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
17051 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17052 if (_res_constr.datalen > 0)
17053 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17055 _res_constr.data = NULL;
17056 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17057 for (size_t c = 0; c < _res_constr.datalen; c++) {
17058 int64_t _res_conv_28 = _res_vals[c];
17059 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
17060 CHECK_ACCESS(_res_conv_28_ptr);
17061 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
17062 FREE((void*)_res_conv_28);
17063 _res_constr.data[c] = _res_conv_28_conv;
17065 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17066 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
17069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17070 LDKCVec_TxidZ _res_constr;
17071 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17072 if (_res_constr.datalen > 0)
17073 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
17075 _res_constr.data = NULL;
17076 for (size_t i = 0; i < _res_constr.datalen; i++) {
17077 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17078 LDKThirtyTwoBytes _res_conv_8_ref;
17079 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
17080 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
17081 _res_constr.data[i] = _res_conv_8_ref;
17083 CVec_TxidZ_free(_res_constr);
17086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
17087 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17088 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
17089 return (int64_t)ret_conv;
17092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
17093 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
17094 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17095 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
17096 return (int64_t)ret_conv;
17099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17100 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
17101 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
17105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17106 if ((_res & 1) != 0) return;
17107 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17108 CHECK_ACCESS(_res_ptr);
17109 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
17111 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
17114 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
17115 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17116 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
17117 return (int64_t)ret_conv;
17119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17120 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
17121 int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
17125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17126 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
17127 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17128 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
17129 return (int64_t)ret_conv;
17132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17133 LDKCVec_MonitorEventZ _res_constr;
17134 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17135 if (_res_constr.datalen > 0)
17136 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17138 _res_constr.data = NULL;
17139 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17140 for (size_t o = 0; o < _res_constr.datalen; o++) {
17141 int64_t _res_conv_14 = _res_vals[o];
17142 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
17143 CHECK_ACCESS(_res_conv_14_ptr);
17144 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
17145 FREE((void*)_res_conv_14);
17146 _res_constr.data[o] = _res_conv_14_conv;
17148 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17149 CVec_MonitorEventZ_free(_res_constr);
17152 static inline uintptr_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
17153 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17154 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
17155 return ((int64_t)ret_conv);
17157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17158 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(arg & ~1);
17159 int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
17163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17164 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(orig & ~1);
17165 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17166 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
17167 return ((int64_t)ret_conv);
17170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) {
17171 LDKOutPoint a_conv;
17172 a_conv.inner = (void*)(a & (~1));
17173 a_conv.is_owned = (a & 1) || (a == 0);
17174 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17175 a_conv = OutPoint_clone(&a_conv);
17176 LDKCVec_MonitorEventZ b_constr;
17177 b_constr.datalen = (*env)->GetArrayLength(env, b);
17178 if (b_constr.datalen > 0)
17179 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17181 b_constr.data = NULL;
17182 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
17183 for (size_t o = 0; o < b_constr.datalen; o++) {
17184 int64_t b_conv_14 = b_vals[o];
17185 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
17186 CHECK_ACCESS(b_conv_14_ptr);
17187 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
17188 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
17189 b_constr.data[o] = b_conv_14_conv;
17191 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
17192 LDKPublicKey c_ref;
17193 CHECK((*env)->GetArrayLength(env, c) == 33);
17194 (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
17195 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17196 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
17197 return ((int64_t)ret_conv);
17200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17201 if ((_res & 1) != 0) return;
17202 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17203 CHECK_ACCESS(_res_ptr);
17204 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
17206 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
17209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17210 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
17211 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17212 if (_res_constr.datalen > 0)
17213 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
17215 _res_constr.data = NULL;
17216 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17217 for (size_t x = 0; x < _res_constr.datalen; x++) {
17218 int64_t _res_conv_49 = _res_vals[x];
17219 void* _res_conv_49_ptr = (void*)(((uintptr_t)_res_conv_49) & ~1);
17220 CHECK_ACCESS(_res_conv_49_ptr);
17221 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
17222 FREE((void*)_res_conv_49);
17223 _res_constr.data[x] = _res_conv_49_conv;
17225 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17226 CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
17229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17230 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17231 CHECK_ACCESS(o_ptr);
17232 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
17233 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
17234 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17235 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
17236 int64_t ret_ref = (uintptr_t)ret_copy;
17240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
17241 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17242 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
17243 int64_t ret_ref = (uintptr_t)ret_copy;
17247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17248 if ((_res & 1) != 0) return;
17249 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17250 CHECK_ACCESS(_res_ptr);
17251 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
17253 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
17256 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
17257 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17258 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
17259 int64_t ret_ref = (uintptr_t)ret_copy;
17262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17263 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
17264 int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
17268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17269 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
17270 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
17271 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
17272 int64_t ret_ref = (uintptr_t)ret_copy;
17276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17277 LDKFixedPenaltyScorer o_conv;
17278 o_conv.inner = (void*)(o & (~1));
17279 o_conv.is_owned = (o & 1) || (o == 0);
17280 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17281 o_conv = FixedPenaltyScorer_clone(&o_conv);
17282 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17283 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
17284 return (int64_t)ret_conv;
17287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17288 LDKDecodeError e_conv;
17289 e_conv.inner = (void*)(e & (~1));
17290 e_conv.is_owned = (e & 1) || (e == 0);
17291 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17292 e_conv = DecodeError_clone(&e_conv);
17293 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17294 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
17295 return (int64_t)ret_conv;
17298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17299 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
17300 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
17304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17305 if ((_res & 1) != 0) return;
17306 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17307 CHECK_ACCESS(_res_ptr);
17308 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
17310 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
17313 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
17314 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17315 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
17316 return (int64_t)ret_conv;
17318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17319 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
17320 int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
17324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17325 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
17326 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17327 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
17328 return (int64_t)ret_conv;
17331 static inline uintptr_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
17332 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17333 *ret_conv = C2Tuple_u64u64Z_clone(arg);
17334 return ((int64_t)ret_conv);
17336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17337 LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)(arg & ~1);
17338 int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
17342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17343 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
17344 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17345 *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
17346 return ((int64_t)ret_conv);
17349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17350 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17351 *ret_conv = C2Tuple_u64u64Z_new(a, b);
17352 return ((int64_t)ret_conv);
17355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17356 if ((_res & 1) != 0) return;
17357 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17358 CHECK_ACCESS(_res_ptr);
17359 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
17361 C2Tuple_u64u64Z_free(_res_conv);
17364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17365 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17366 CHECK_ACCESS(o_ptr);
17367 LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
17368 o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)(((uintptr_t)o) & ~1));
17369 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17370 *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
17371 int64_t ret_ref = (uintptr_t)ret_copy;
17375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
17376 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17377 *ret_copy = COption_C2Tuple_u64u64ZZ_none();
17378 int64_t ret_ref = (uintptr_t)ret_copy;
17382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17383 if ((_res & 1) != 0) return;
17384 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17385 CHECK_ACCESS(_res_ptr);
17386 LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
17388 COption_C2Tuple_u64u64ZZ_free(_res_conv);
17391 static inline uintptr_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
17392 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17393 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
17394 int64_t ret_ref = (uintptr_t)ret_copy;
17397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17398 LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)arg;
17399 int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
17403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17404 LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)orig;
17405 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17406 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
17407 int64_t ret_ref = (uintptr_t)ret_copy;
17411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17412 LDKCVec_NodeIdZ _res_constr;
17413 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17414 if (_res_constr.datalen > 0)
17415 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
17417 _res_constr.data = NULL;
17418 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17419 for (size_t i = 0; i < _res_constr.datalen; i++) {
17420 int64_t _res_conv_8 = _res_vals[i];
17421 LDKNodeId _res_conv_8_conv;
17422 _res_conv_8_conv.inner = (void*)(_res_conv_8 & (~1));
17423 _res_conv_8_conv.is_owned = (_res_conv_8 & 1) || (_res_conv_8 == 0);
17424 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
17425 _res_constr.data[i] = _res_conv_8_conv;
17427 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17428 CVec_NodeIdZ_free(_res_constr);
17431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17432 LDKProbabilisticScorer o_conv;
17433 o_conv.inner = (void*)(o & (~1));
17434 o_conv.is_owned = (o & 1) || (o == 0);
17435 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17436 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
17437 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
17438 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
17439 return (int64_t)ret_conv;
17442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17443 LDKDecodeError e_conv;
17444 e_conv.inner = (void*)(e & (~1));
17445 e_conv.is_owned = (e & 1) || (e == 0);
17446 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17447 e_conv = DecodeError_clone(&e_conv);
17448 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
17449 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
17450 return (int64_t)ret_conv;
17453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17454 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
17455 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
17459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17460 if ((_res & 1) != 0) return;
17461 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17462 CHECK_ACCESS(_res_ptr);
17463 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
17465 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
17468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17469 LDKInitFeatures o_conv;
17470 o_conv.inner = (void*)(o & (~1));
17471 o_conv.is_owned = (o & 1) || (o == 0);
17472 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17473 o_conv = InitFeatures_clone(&o_conv);
17474 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17475 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
17476 return (int64_t)ret_conv;
17479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17480 LDKDecodeError e_conv;
17481 e_conv.inner = (void*)(e & (~1));
17482 e_conv.is_owned = (e & 1) || (e == 0);
17483 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17484 e_conv = DecodeError_clone(&e_conv);
17485 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17486 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
17487 return (int64_t)ret_conv;
17490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17491 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
17492 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
17496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17497 if ((_res & 1) != 0) return;
17498 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17499 CHECK_ACCESS(_res_ptr);
17500 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
17502 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
17505 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17506 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17507 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
17508 return (int64_t)ret_conv;
17510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17511 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
17512 int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17517 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
17518 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17519 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
17520 return (int64_t)ret_conv;
17523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17524 LDKChannelFeatures o_conv;
17525 o_conv.inner = (void*)(o & (~1));
17526 o_conv.is_owned = (o & 1) || (o == 0);
17527 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17528 o_conv = ChannelFeatures_clone(&o_conv);
17529 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17530 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
17531 return (int64_t)ret_conv;
17534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17535 LDKDecodeError e_conv;
17536 e_conv.inner = (void*)(e & (~1));
17537 e_conv.is_owned = (e & 1) || (e == 0);
17538 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17539 e_conv = DecodeError_clone(&e_conv);
17540 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17541 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
17542 return (int64_t)ret_conv;
17545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17546 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
17547 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
17551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17552 if ((_res & 1) != 0) return;
17553 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17554 CHECK_ACCESS(_res_ptr);
17555 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
17557 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
17560 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17561 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17562 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
17563 return (int64_t)ret_conv;
17565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17566 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
17567 int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17572 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
17573 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17574 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
17575 return (int64_t)ret_conv;
17578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17579 LDKNodeFeatures o_conv;
17580 o_conv.inner = (void*)(o & (~1));
17581 o_conv.is_owned = (o & 1) || (o == 0);
17582 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17583 o_conv = NodeFeatures_clone(&o_conv);
17584 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17585 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
17586 return (int64_t)ret_conv;
17589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17590 LDKDecodeError e_conv;
17591 e_conv.inner = (void*)(e & (~1));
17592 e_conv.is_owned = (e & 1) || (e == 0);
17593 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17594 e_conv = DecodeError_clone(&e_conv);
17595 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17596 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
17597 return (int64_t)ret_conv;
17600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17601 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
17602 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
17606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17607 if ((_res & 1) != 0) return;
17608 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17609 CHECK_ACCESS(_res_ptr);
17610 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
17612 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
17615 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17616 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17617 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
17618 return (int64_t)ret_conv;
17620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17621 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
17622 int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17627 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
17628 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17629 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
17630 return (int64_t)ret_conv;
17633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17634 LDKInvoiceFeatures o_conv;
17635 o_conv.inner = (void*)(o & (~1));
17636 o_conv.is_owned = (o & 1) || (o == 0);
17637 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17638 o_conv = InvoiceFeatures_clone(&o_conv);
17639 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17640 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
17641 return (int64_t)ret_conv;
17644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17645 LDKDecodeError e_conv;
17646 e_conv.inner = (void*)(e & (~1));
17647 e_conv.is_owned = (e & 1) || (e == 0);
17648 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17649 e_conv = DecodeError_clone(&e_conv);
17650 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17651 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
17652 return (int64_t)ret_conv;
17655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17656 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
17657 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
17661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17662 if ((_res & 1) != 0) return;
17663 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17664 CHECK_ACCESS(_res_ptr);
17665 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
17667 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
17670 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17671 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17672 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
17673 return (int64_t)ret_conv;
17675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17676 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
17677 int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17682 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
17683 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17684 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
17685 return (int64_t)ret_conv;
17688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17689 LDKChannelTypeFeatures o_conv;
17690 o_conv.inner = (void*)(o & (~1));
17691 o_conv.is_owned = (o & 1) || (o == 0);
17692 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17693 o_conv = ChannelTypeFeatures_clone(&o_conv);
17694 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17695 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
17696 return (int64_t)ret_conv;
17699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17700 LDKDecodeError e_conv;
17701 e_conv.inner = (void*)(e & (~1));
17702 e_conv.is_owned = (e & 1) || (e == 0);
17703 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17704 e_conv = DecodeError_clone(&e_conv);
17705 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17706 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
17707 return (int64_t)ret_conv;
17710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17711 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
17712 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
17716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17717 if ((_res & 1) != 0) return;
17718 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17719 CHECK_ACCESS(_res_ptr);
17720 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
17722 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
17725 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17726 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17727 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
17728 return (int64_t)ret_conv;
17730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17731 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
17732 int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17737 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
17738 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
17739 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
17740 return (int64_t)ret_conv;
17743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17745 o_conv.inner = (void*)(o & (~1));
17746 o_conv.is_owned = (o & 1) || (o == 0);
17747 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17748 o_conv = NodeId_clone(&o_conv);
17749 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17750 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
17751 return (int64_t)ret_conv;
17754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17755 LDKDecodeError e_conv;
17756 e_conv.inner = (void*)(e & (~1));
17757 e_conv.is_owned = (e & 1) || (e == 0);
17758 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17759 e_conv = DecodeError_clone(&e_conv);
17760 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17761 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
17762 return (int64_t)ret_conv;
17765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17766 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
17767 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
17771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17772 if ((_res & 1) != 0) return;
17773 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17774 CHECK_ACCESS(_res_ptr);
17775 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
17777 CResult_NodeIdDecodeErrorZ_free(_res_conv);
17780 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
17781 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17782 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
17783 return (int64_t)ret_conv;
17785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17786 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
17787 int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
17791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17792 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
17793 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
17794 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
17795 return (int64_t)ret_conv;
17798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17799 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17800 CHECK_ACCESS(o_ptr);
17801 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
17802 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
17803 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17804 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
17805 return (int64_t)ret_conv;
17808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17809 LDKDecodeError e_conv;
17810 e_conv.inner = (void*)(e & (~1));
17811 e_conv.is_owned = (e & 1) || (e == 0);
17812 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17813 e_conv = DecodeError_clone(&e_conv);
17814 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17815 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
17816 return (int64_t)ret_conv;
17819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17820 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
17821 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
17825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17826 if ((_res & 1) != 0) return;
17827 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17828 CHECK_ACCESS(_res_ptr);
17829 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
17831 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
17834 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
17835 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17836 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
17837 return (int64_t)ret_conv;
17839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17840 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
17841 int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
17845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17846 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
17847 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
17848 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
17849 return (int64_t)ret_conv;
17852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17853 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17854 CHECK_ACCESS(o_ptr);
17855 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
17856 if (o_conv.free == LDKAccess_JCalls_free) {
17857 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17858 LDKAccess_JCalls_cloned(&o_conv);
17860 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17861 *ret_copy = COption_AccessZ_some(o_conv);
17862 int64_t ret_ref = (uintptr_t)ret_copy;
17866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
17867 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
17868 *ret_copy = COption_AccessZ_none();
17869 int64_t ret_ref = (uintptr_t)ret_copy;
17873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17874 if ((_res & 1) != 0) return;
17875 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17876 CHECK_ACCESS(_res_ptr);
17877 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
17879 COption_AccessZ_free(_res_conv);
17882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
17883 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17884 *ret_conv = CResult_boolLightningErrorZ_ok(o);
17885 return (int64_t)ret_conv;
17888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17889 LDKLightningError e_conv;
17890 e_conv.inner = (void*)(e & (~1));
17891 e_conv.is_owned = (e & 1) || (e == 0);
17892 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17893 e_conv = LightningError_clone(&e_conv);
17894 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17895 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
17896 return (int64_t)ret_conv;
17899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17900 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
17901 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
17905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17906 if ((_res & 1) != 0) return;
17907 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17908 CHECK_ACCESS(_res_ptr);
17909 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
17911 CResult_boolLightningErrorZ_free(_res_conv);
17914 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
17915 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17916 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
17917 return (int64_t)ret_conv;
17919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17920 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
17921 int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
17925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17926 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
17927 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17928 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
17929 return (int64_t)ret_conv;
17932 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
17933 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17934 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
17935 return ((int64_t)ret_conv);
17937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17938 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
17939 int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
17943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17944 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
17945 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17946 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
17947 return ((int64_t)ret_conv);
17950 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) {
17951 LDKChannelAnnouncement a_conv;
17952 a_conv.inner = (void*)(a & (~1));
17953 a_conv.is_owned = (a & 1) || (a == 0);
17954 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17955 a_conv = ChannelAnnouncement_clone(&a_conv);
17956 LDKChannelUpdate b_conv;
17957 b_conv.inner = (void*)(b & (~1));
17958 b_conv.is_owned = (b & 1) || (b == 0);
17959 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17960 b_conv = ChannelUpdate_clone(&b_conv);
17961 LDKChannelUpdate c_conv;
17962 c_conv.inner = (void*)(c & (~1));
17963 c_conv.is_owned = (c & 1) || (c == 0);
17964 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17965 c_conv = ChannelUpdate_clone(&c_conv);
17966 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
17967 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
17968 return ((int64_t)ret_conv);
17971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17972 if ((_res & 1) != 0) return;
17973 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17974 CHECK_ACCESS(_res_ptr);
17975 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
17977 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
17980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17981 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
17982 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17983 if (_res_constr.datalen > 0)
17984 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
17986 _res_constr.data = NULL;
17987 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17988 for (size_t h = 0; h < _res_constr.datalen; h++) {
17989 int64_t _res_conv_59 = _res_vals[h];
17990 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
17991 CHECK_ACCESS(_res_conv_59_ptr);
17992 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
17993 FREE((void*)_res_conv_59);
17994 _res_constr.data[h] = _res_conv_59_conv;
17996 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17997 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
18000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18001 LDKCVec_NodeAnnouncementZ _res_constr;
18002 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18003 if (_res_constr.datalen > 0)
18004 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
18006 _res_constr.data = NULL;
18007 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18008 for (size_t s = 0; s < _res_constr.datalen; s++) {
18009 int64_t _res_conv_18 = _res_vals[s];
18010 LDKNodeAnnouncement _res_conv_18_conv;
18011 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
18012 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
18013 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
18014 _res_constr.data[s] = _res_conv_18_conv;
18016 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18017 CVec_NodeAnnouncementZ_free(_res_constr);
18020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
18021 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18022 *ret_conv = CResult_NoneLightningErrorZ_ok();
18023 return (int64_t)ret_conv;
18026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18027 LDKLightningError e_conv;
18028 e_conv.inner = (void*)(e & (~1));
18029 e_conv.is_owned = (e & 1) || (e == 0);
18030 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18031 e_conv = LightningError_clone(&e_conv);
18032 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18033 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
18034 return (int64_t)ret_conv;
18037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18038 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
18039 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
18043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18044 if ((_res & 1) != 0) return;
18045 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18046 CHECK_ACCESS(_res_ptr);
18047 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
18049 CResult_NoneLightningErrorZ_free(_res_conv);
18052 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
18053 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18054 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
18055 return (int64_t)ret_conv;
18057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18058 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
18059 int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
18063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18064 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
18065 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18066 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
18067 return (int64_t)ret_conv;
18070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18071 LDKChannelUpdateInfo o_conv;
18072 o_conv.inner = (void*)(o & (~1));
18073 o_conv.is_owned = (o & 1) || (o == 0);
18074 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18075 o_conv = ChannelUpdateInfo_clone(&o_conv);
18076 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18077 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
18078 return (int64_t)ret_conv;
18081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18082 LDKDecodeError e_conv;
18083 e_conv.inner = (void*)(e & (~1));
18084 e_conv.is_owned = (e & 1) || (e == 0);
18085 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18086 e_conv = DecodeError_clone(&e_conv);
18087 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18088 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
18089 return (int64_t)ret_conv;
18092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18093 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
18094 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
18098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18099 if ((_res & 1) != 0) return;
18100 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18101 CHECK_ACCESS(_res_ptr);
18102 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
18104 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
18107 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
18108 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18109 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
18110 return (int64_t)ret_conv;
18112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18113 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
18114 int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
18118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18119 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
18120 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18121 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
18122 return (int64_t)ret_conv;
18125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18126 LDKChannelInfo o_conv;
18127 o_conv.inner = (void*)(o & (~1));
18128 o_conv.is_owned = (o & 1) || (o == 0);
18129 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18130 o_conv = ChannelInfo_clone(&o_conv);
18131 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18132 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
18133 return (int64_t)ret_conv;
18136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18137 LDKDecodeError e_conv;
18138 e_conv.inner = (void*)(e & (~1));
18139 e_conv.is_owned = (e & 1) || (e == 0);
18140 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18141 e_conv = DecodeError_clone(&e_conv);
18142 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18143 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
18144 return (int64_t)ret_conv;
18147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18148 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
18149 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
18153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18154 if ((_res & 1) != 0) return;
18155 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18156 CHECK_ACCESS(_res_ptr);
18157 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
18159 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
18162 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
18163 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18164 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
18165 return (int64_t)ret_conv;
18167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18168 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
18169 int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
18173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18174 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
18175 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18176 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
18177 return (int64_t)ret_conv;
18180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18181 LDKRoutingFees o_conv;
18182 o_conv.inner = (void*)(o & (~1));
18183 o_conv.is_owned = (o & 1) || (o == 0);
18184 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18185 o_conv = RoutingFees_clone(&o_conv);
18186 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18187 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
18188 return (int64_t)ret_conv;
18191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18192 LDKDecodeError e_conv;
18193 e_conv.inner = (void*)(e & (~1));
18194 e_conv.is_owned = (e & 1) || (e == 0);
18195 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18196 e_conv = DecodeError_clone(&e_conv);
18197 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18198 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
18199 return (int64_t)ret_conv;
18202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18203 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
18204 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
18208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18209 if ((_res & 1) != 0) return;
18210 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18211 CHECK_ACCESS(_res_ptr);
18212 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
18214 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
18217 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
18218 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18219 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
18220 return (int64_t)ret_conv;
18222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18223 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
18224 int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
18228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18229 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
18230 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18231 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
18232 return (int64_t)ret_conv;
18235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18236 LDKCVec_NetAddressZ _res_constr;
18237 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18238 if (_res_constr.datalen > 0)
18239 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18241 _res_constr.data = NULL;
18242 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18243 for (size_t m = 0; m < _res_constr.datalen; m++) {
18244 int64_t _res_conv_12 = _res_vals[m];
18245 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
18246 CHECK_ACCESS(_res_conv_12_ptr);
18247 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
18248 FREE((void*)_res_conv_12);
18249 _res_constr.data[m] = _res_conv_12_conv;
18251 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18252 CVec_NetAddressZ_free(_res_constr);
18255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18256 LDKNodeAnnouncementInfo o_conv;
18257 o_conv.inner = (void*)(o & (~1));
18258 o_conv.is_owned = (o & 1) || (o == 0);
18259 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18260 o_conv = NodeAnnouncementInfo_clone(&o_conv);
18261 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18262 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
18263 return (int64_t)ret_conv;
18266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18267 LDKDecodeError e_conv;
18268 e_conv.inner = (void*)(e & (~1));
18269 e_conv.is_owned = (e & 1) || (e == 0);
18270 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18271 e_conv = DecodeError_clone(&e_conv);
18272 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18273 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
18274 return (int64_t)ret_conv;
18277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18278 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
18279 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
18283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18284 if ((_res & 1) != 0) return;
18285 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18286 CHECK_ACCESS(_res_ptr);
18287 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
18289 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
18292 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
18293 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18294 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
18295 return (int64_t)ret_conv;
18297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18298 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
18299 int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
18303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18304 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
18305 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18306 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
18307 return (int64_t)ret_conv;
18310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18311 LDKNodeAlias o_conv;
18312 o_conv.inner = (void*)(o & (~1));
18313 o_conv.is_owned = (o & 1) || (o == 0);
18314 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18315 o_conv = NodeAlias_clone(&o_conv);
18316 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18317 *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
18318 return (int64_t)ret_conv;
18321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18322 LDKDecodeError e_conv;
18323 e_conv.inner = (void*)(e & (~1));
18324 e_conv.is_owned = (e & 1) || (e == 0);
18325 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18326 e_conv = DecodeError_clone(&e_conv);
18327 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18328 *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
18329 return (int64_t)ret_conv;
18332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18333 LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(o & ~1);
18334 jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
18338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18339 if ((_res & 1) != 0) return;
18340 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18341 CHECK_ACCESS(_res_ptr);
18342 LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
18344 CResult_NodeAliasDecodeErrorZ_free(_res_conv);
18347 static inline uintptr_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
18348 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18349 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
18350 return (int64_t)ret_conv;
18352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18353 LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(arg & ~1);
18354 int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
18358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18359 LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(orig & ~1);
18360 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18361 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
18362 return (int64_t)ret_conv;
18365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18366 LDKNodeInfo o_conv;
18367 o_conv.inner = (void*)(o & (~1));
18368 o_conv.is_owned = (o & 1) || (o == 0);
18369 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18370 o_conv = NodeInfo_clone(&o_conv);
18371 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18372 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
18373 return (int64_t)ret_conv;
18376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18377 LDKDecodeError e_conv;
18378 e_conv.inner = (void*)(e & (~1));
18379 e_conv.is_owned = (e & 1) || (e == 0);
18380 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18381 e_conv = DecodeError_clone(&e_conv);
18382 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18383 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
18384 return (int64_t)ret_conv;
18387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18388 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
18389 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
18393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18394 if ((_res & 1) != 0) return;
18395 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18396 CHECK_ACCESS(_res_ptr);
18397 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
18399 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
18402 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
18403 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18404 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
18405 return (int64_t)ret_conv;
18407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18408 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
18409 int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
18413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18414 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
18415 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18416 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
18417 return (int64_t)ret_conv;
18420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18421 LDKNetworkGraph o_conv;
18422 o_conv.inner = (void*)(o & (~1));
18423 o_conv.is_owned = (o & 1) || (o == 0);
18424 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18425 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
18426 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18427 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
18428 return (int64_t)ret_conv;
18431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18432 LDKDecodeError e_conv;
18433 e_conv.inner = (void*)(e & (~1));
18434 e_conv.is_owned = (e & 1) || (e == 0);
18435 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18436 e_conv = DecodeError_clone(&e_conv);
18437 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18438 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
18439 return (int64_t)ret_conv;
18442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18443 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
18444 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
18448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18449 if ((_res & 1) != 0) return;
18450 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18451 CHECK_ACCESS(_res_ptr);
18452 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
18454 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
18457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
18458 LDKCVec_NetAddressZ o_constr;
18459 o_constr.datalen = (*env)->GetArrayLength(env, o);
18460 if (o_constr.datalen > 0)
18461 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18463 o_constr.data = NULL;
18464 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18465 for (size_t m = 0; m < o_constr.datalen; m++) {
18466 int64_t o_conv_12 = o_vals[m];
18467 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
18468 CHECK_ACCESS(o_conv_12_ptr);
18469 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
18470 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
18471 o_constr.data[m] = o_conv_12_conv;
18473 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18474 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18475 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
18476 int64_t ret_ref = (uintptr_t)ret_copy;
18480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
18481 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18482 *ret_copy = COption_CVec_NetAddressZZ_none();
18483 int64_t ret_ref = (uintptr_t)ret_copy;
18487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18488 if ((_res & 1) != 0) return;
18489 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18490 CHECK_ACCESS(_res_ptr);
18491 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
18493 COption_CVec_NetAddressZZ_free(_res_conv);
18496 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
18497 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18498 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
18499 int64_t ret_ref = (uintptr_t)ret_copy;
18502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18503 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
18504 int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
18508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18509 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
18510 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18511 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
18512 int64_t ret_ref = (uintptr_t)ret_copy;
18516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18517 LDKDelayedPaymentOutputDescriptor o_conv;
18518 o_conv.inner = (void*)(o & (~1));
18519 o_conv.is_owned = (o & 1) || (o == 0);
18520 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18521 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
18522 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18523 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18524 return (int64_t)ret_conv;
18527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18528 LDKDecodeError e_conv;
18529 e_conv.inner = (void*)(e & (~1));
18530 e_conv.is_owned = (e & 1) || (e == 0);
18531 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18532 e_conv = DecodeError_clone(&e_conv);
18533 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18534 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18535 return (int64_t)ret_conv;
18538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18539 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
18540 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18545 if ((_res & 1) != 0) return;
18546 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18547 CHECK_ACCESS(_res_ptr);
18548 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18550 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18553 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18554 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18555 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18556 return (int64_t)ret_conv;
18558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18559 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
18560 int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18565 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
18566 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18567 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18568 return (int64_t)ret_conv;
18571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18572 LDKStaticPaymentOutputDescriptor o_conv;
18573 o_conv.inner = (void*)(o & (~1));
18574 o_conv.is_owned = (o & 1) || (o == 0);
18575 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18576 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
18577 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18578 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18579 return (int64_t)ret_conv;
18582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18583 LDKDecodeError e_conv;
18584 e_conv.inner = (void*)(e & (~1));
18585 e_conv.is_owned = (e & 1) || (e == 0);
18586 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18587 e_conv = DecodeError_clone(&e_conv);
18588 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18589 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18590 return (int64_t)ret_conv;
18593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18594 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
18595 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18600 if ((_res & 1) != 0) return;
18601 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18602 CHECK_ACCESS(_res_ptr);
18603 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18605 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18608 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18609 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18610 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18611 return (int64_t)ret_conv;
18613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18614 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
18615 int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18620 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
18621 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18622 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18623 return (int64_t)ret_conv;
18626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18627 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18628 CHECK_ACCESS(o_ptr);
18629 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
18630 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
18631 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18632 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
18633 return (int64_t)ret_conv;
18636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18637 LDKDecodeError e_conv;
18638 e_conv.inner = (void*)(e & (~1));
18639 e_conv.is_owned = (e & 1) || (e == 0);
18640 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18641 e_conv = DecodeError_clone(&e_conv);
18642 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18643 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
18644 return (int64_t)ret_conv;
18647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18648 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
18649 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18654 if ((_res & 1) != 0) return;
18655 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18656 CHECK_ACCESS(_res_ptr);
18657 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
18659 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
18662 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18663 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18664 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
18665 return (int64_t)ret_conv;
18667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18668 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
18669 int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18674 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
18675 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18676 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
18677 return (int64_t)ret_conv;
18680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18681 LDKCVec_PaymentPreimageZ _res_constr;
18682 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18683 if (_res_constr.datalen > 0)
18684 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
18686 _res_constr.data = NULL;
18687 for (size_t i = 0; i < _res_constr.datalen; i++) {
18688 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18689 LDKThirtyTwoBytes _res_conv_8_ref;
18690 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
18691 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
18692 _res_constr.data[i] = _res_conv_8_ref;
18694 CVec_PaymentPreimageZ_free(_res_constr);
18697 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
18698 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18699 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
18700 return ((int64_t)ret_conv);
18702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18703 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
18704 int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
18708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18709 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
18710 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18711 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
18712 return ((int64_t)ret_conv);
18715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
18716 LDKSignature a_ref;
18717 CHECK((*env)->GetArrayLength(env, a) == 64);
18718 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18719 LDKCVec_SignatureZ b_constr;
18720 b_constr.datalen = (*env)->GetArrayLength(env, b);
18721 if (b_constr.datalen > 0)
18722 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18724 b_constr.data = NULL;
18725 for (size_t i = 0; i < b_constr.datalen; i++) {
18726 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
18727 LDKSignature b_conv_8_ref;
18728 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
18729 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
18730 b_constr.data[i] = b_conv_8_ref;
18732 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
18733 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
18734 return ((int64_t)ret_conv);
18737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18738 if ((_res & 1) != 0) return;
18739 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18740 CHECK_ACCESS(_res_ptr);
18741 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
18743 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
18746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18747 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18748 CHECK_ACCESS(o_ptr);
18749 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
18750 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
18751 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18752 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
18753 return (int64_t)ret_conv;
18756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
18757 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18758 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
18759 return (int64_t)ret_conv;
18762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18763 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
18764 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
18768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18769 if ((_res & 1) != 0) return;
18770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18771 CHECK_ACCESS(_res_ptr);
18772 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
18774 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
18777 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
18778 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18779 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
18780 return (int64_t)ret_conv;
18782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18783 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
18784 int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
18788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18789 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
18790 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
18791 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
18792 return (int64_t)ret_conv;
18795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18796 LDKSignature o_ref;
18797 CHECK((*env)->GetArrayLength(env, o) == 64);
18798 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
18799 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18800 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
18801 return (int64_t)ret_conv;
18804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
18805 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18806 *ret_conv = CResult_SignatureNoneZ_err();
18807 return (int64_t)ret_conv;
18810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18811 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
18812 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
18816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18817 if ((_res & 1) != 0) return;
18818 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18819 CHECK_ACCESS(_res_ptr);
18820 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
18822 CResult_SignatureNoneZ_free(_res_conv);
18825 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
18826 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18827 *ret_conv = CResult_SignatureNoneZ_clone(arg);
18828 return (int64_t)ret_conv;
18830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18831 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
18832 int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
18836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18837 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
18838 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
18839 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
18840 return (int64_t)ret_conv;
18843 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
18844 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18845 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
18846 return ((int64_t)ret_conv);
18848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18849 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
18850 int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
18854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18855 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
18856 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18857 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
18858 return ((int64_t)ret_conv);
18861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18862 LDKSignature a_ref;
18863 CHECK((*env)->GetArrayLength(env, a) == 64);
18864 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
18865 LDKSignature b_ref;
18866 CHECK((*env)->GetArrayLength(env, b) == 64);
18867 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
18868 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
18869 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
18870 return ((int64_t)ret_conv);
18873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18874 if ((_res & 1) != 0) return;
18875 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18876 CHECK_ACCESS(_res_ptr);
18877 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
18879 C2Tuple_SignatureSignatureZ_free(_res_conv);
18882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18883 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18884 CHECK_ACCESS(o_ptr);
18885 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
18886 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
18887 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18888 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
18889 return (int64_t)ret_conv;
18892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
18893 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18894 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
18895 return (int64_t)ret_conv;
18898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18899 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
18900 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
18904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18905 if ((_res & 1) != 0) return;
18906 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18907 CHECK_ACCESS(_res_ptr);
18908 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
18910 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
18913 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
18914 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18915 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
18916 return (int64_t)ret_conv;
18918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18919 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
18920 int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
18924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18925 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
18926 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
18927 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
18928 return (int64_t)ret_conv;
18931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18932 LDKSecretKey o_ref;
18933 CHECK((*env)->GetArrayLength(env, o) == 32);
18934 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
18935 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18936 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
18937 return (int64_t)ret_conv;
18940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
18941 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18942 *ret_conv = CResult_SecretKeyNoneZ_err();
18943 return (int64_t)ret_conv;
18946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18947 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
18948 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
18952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18953 if ((_res & 1) != 0) return;
18954 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18955 CHECK_ACCESS(_res_ptr);
18956 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
18958 CResult_SecretKeyNoneZ_free(_res_conv);
18961 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
18962 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18963 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
18964 return (int64_t)ret_conv;
18966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18967 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
18968 int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
18972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18973 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
18974 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
18975 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
18976 return (int64_t)ret_conv;
18979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18980 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18981 CHECK_ACCESS(o_ptr);
18982 LDKSign o_conv = *(LDKSign*)(o_ptr);
18983 if (o_conv.free == LDKSign_JCalls_free) {
18984 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18985 LDKSign_JCalls_cloned(&o_conv);
18987 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18988 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
18989 return (int64_t)ret_conv;
18992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18993 LDKDecodeError e_conv;
18994 e_conv.inner = (void*)(e & (~1));
18995 e_conv.is_owned = (e & 1) || (e == 0);
18996 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18997 e_conv = DecodeError_clone(&e_conv);
18998 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
18999 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
19000 return (int64_t)ret_conv;
19003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19004 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
19005 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
19009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19010 if ((_res & 1) != 0) return;
19011 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19012 CHECK_ACCESS(_res_ptr);
19013 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
19015 CResult_SignDecodeErrorZ_free(_res_conv);
19018 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
19019 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19020 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
19021 return (int64_t)ret_conv;
19023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19024 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
19025 int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
19029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19030 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
19031 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19032 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
19033 return (int64_t)ret_conv;
19036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19037 LDKCVec_u5Z _res_constr;
19038 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19039 if (_res_constr.datalen > 0)
19040 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
19042 _res_constr.data = NULL;
19043 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
19044 for (size_t h = 0; h < _res_constr.datalen; h++) {
19045 int8_t _res_conv_7 = _res_vals[h];
19047 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
19049 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
19050 CVec_u5Z_free(_res_constr);
19053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19054 LDKRecoverableSignature o_ref;
19055 CHECK((*env)->GetArrayLength(env, o) == 68);
19056 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
19057 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19058 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
19059 return (int64_t)ret_conv;
19062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
19063 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19064 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
19065 return (int64_t)ret_conv;
19068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19069 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
19070 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
19074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19075 if ((_res & 1) != 0) return;
19076 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19077 CHECK_ACCESS(_res_ptr);
19078 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
19080 CResult_RecoverableSignatureNoneZ_free(_res_conv);
19083 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
19084 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19085 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
19086 return (int64_t)ret_conv;
19088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19089 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
19090 int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
19094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19095 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
19096 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19097 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
19098 return (int64_t)ret_conv;
19101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19102 LDKCVec_u8Z _res_ref;
19103 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19104 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
19105 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19106 CVec_u8Z_free(_res_ref);
19109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19110 LDKCVec_CVec_u8ZZ _res_constr;
19111 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19112 if (_res_constr.datalen > 0)
19113 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
19115 _res_constr.data = NULL;
19116 for (size_t i = 0; i < _res_constr.datalen; i++) {
19117 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19118 LDKCVec_u8Z _res_conv_8_ref;
19119 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
19120 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
19121 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
19122 _res_constr.data[i] = _res_conv_8_ref;
19124 CVec_CVec_u8ZZ_free(_res_constr);
19127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
19128 LDKCVec_CVec_u8ZZ o_constr;
19129 o_constr.datalen = (*env)->GetArrayLength(env, o);
19130 if (o_constr.datalen > 0)
19131 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
19133 o_constr.data = NULL;
19134 for (size_t i = 0; i < o_constr.datalen; i++) {
19135 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
19136 LDKCVec_u8Z o_conv_8_ref;
19137 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
19138 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
19139 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
19140 o_constr.data[i] = o_conv_8_ref;
19142 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19143 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
19144 return (int64_t)ret_conv;
19147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
19148 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19149 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
19150 return (int64_t)ret_conv;
19153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19154 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
19155 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
19159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19160 if ((_res & 1) != 0) return;
19161 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19162 CHECK_ACCESS(_res_ptr);
19163 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
19165 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
19168 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
19169 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19170 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
19171 return (int64_t)ret_conv;
19173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19174 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
19175 int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
19179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19180 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
19181 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19182 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
19183 return (int64_t)ret_conv;
19186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19187 LDKInMemorySigner o_conv;
19188 o_conv.inner = (void*)(o & (~1));
19189 o_conv.is_owned = (o & 1) || (o == 0);
19190 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19191 o_conv = InMemorySigner_clone(&o_conv);
19192 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19193 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
19194 return (int64_t)ret_conv;
19197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19198 LDKDecodeError e_conv;
19199 e_conv.inner = (void*)(e & (~1));
19200 e_conv.is_owned = (e & 1) || (e == 0);
19201 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19202 e_conv = DecodeError_clone(&e_conv);
19203 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19204 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
19205 return (int64_t)ret_conv;
19208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19209 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
19210 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
19214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19215 if ((_res & 1) != 0) return;
19216 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19217 CHECK_ACCESS(_res_ptr);
19218 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
19220 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
19223 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
19224 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19225 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
19226 return (int64_t)ret_conv;
19228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19229 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
19230 int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
19234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19235 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
19236 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19237 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
19238 return (int64_t)ret_conv;
19241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19242 LDKCVec_TxOutZ _res_constr;
19243 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19244 if (_res_constr.datalen > 0)
19245 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19247 _res_constr.data = NULL;
19248 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19249 for (size_t h = 0; h < _res_constr.datalen; h++) {
19250 int64_t _res_conv_7 = _res_vals[h];
19251 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
19252 CHECK_ACCESS(_res_conv_7_ptr);
19253 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19254 FREE((void*)_res_conv_7);
19255 _res_constr.data[h] = _res_conv_7_conv;
19257 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19258 CVec_TxOutZ_free(_res_constr);
19261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19262 LDKTransaction o_ref;
19263 o_ref.datalen = (*env)->GetArrayLength(env, o);
19264 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
19265 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
19266 o_ref.data_is_owned = true;
19267 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19268 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
19269 return (int64_t)ret_conv;
19272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
19273 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19274 *ret_conv = CResult_TransactionNoneZ_err();
19275 return (int64_t)ret_conv;
19278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19279 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
19280 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
19284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19285 if ((_res & 1) != 0) return;
19286 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19287 CHECK_ACCESS(_res_ptr);
19288 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
19290 CResult_TransactionNoneZ_free(_res_conv);
19293 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
19294 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19295 *ret_conv = CResult_TransactionNoneZ_clone(arg);
19296 return (int64_t)ret_conv;
19298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19299 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
19300 int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
19304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19305 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
19306 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19307 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
19308 return (int64_t)ret_conv;
19311 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
19312 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19313 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
19314 return ((int64_t)ret_conv);
19316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19317 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
19318 int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
19322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19323 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
19324 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19325 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
19326 return ((int64_t)ret_conv);
19329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19330 LDKThirtyTwoBytes a_ref;
19331 CHECK((*env)->GetArrayLength(env, a) == 32);
19332 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19333 LDKChannelMonitor b_conv;
19334 b_conv.inner = (void*)(b & (~1));
19335 b_conv.is_owned = (b & 1) || (b == 0);
19336 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19337 b_conv = ChannelMonitor_clone(&b_conv);
19338 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19339 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
19340 return ((int64_t)ret_conv);
19343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19344 if ((_res & 1) != 0) return;
19345 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19346 CHECK_ACCESS(_res_ptr);
19347 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
19349 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
19352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19353 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
19354 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19355 if (_res_constr.datalen > 0)
19356 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
19358 _res_constr.data = NULL;
19359 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19360 for (size_t j = 0; j < _res_constr.datalen; j++) {
19361 int64_t _res_conv_35 = _res_vals[j];
19362 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
19363 CHECK_ACCESS(_res_conv_35_ptr);
19364 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
19365 FREE((void*)_res_conv_35);
19366 _res_constr.data[j] = _res_conv_35_conv;
19368 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19369 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
19372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
19373 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
19374 o_constr.datalen = (*env)->GetArrayLength(env, o);
19375 if (o_constr.datalen > 0)
19376 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
19378 o_constr.data = NULL;
19379 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
19380 for (size_t j = 0; j < o_constr.datalen; j++) {
19381 int64_t o_conv_35 = o_vals[j];
19382 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
19383 CHECK_ACCESS(o_conv_35_ptr);
19384 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
19385 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
19386 o_constr.data[j] = o_conv_35_conv;
19388 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
19389 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19390 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
19391 return (int64_t)ret_conv;
19394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19395 LDKIOError e_conv = LDKIOError_from_java(env, e);
19396 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19397 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
19398 return (int64_t)ret_conv;
19401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19402 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
19403 jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
19407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19408 if ((_res & 1) != 0) return;
19409 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19410 CHECK_ACCESS(_res_ptr);
19411 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
19413 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
19416 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
19417 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19418 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
19419 return (int64_t)ret_conv;
19421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19422 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
19423 int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
19427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19428 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
19429 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19430 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
19431 return (int64_t)ret_conv;
19434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
19435 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19436 *ret_copy = COption_u16Z_some(o);
19437 int64_t ret_ref = (uintptr_t)ret_copy;
19441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
19442 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19443 *ret_copy = COption_u16Z_none();
19444 int64_t ret_ref = (uintptr_t)ret_copy;
19448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
19449 if ((_res & 1) != 0) return;
19450 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19451 CHECK_ACCESS(_res_ptr);
19452 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
19454 COption_u16Z_free(_res_conv);
19457 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
19458 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19459 *ret_copy = COption_u16Z_clone(arg);
19460 int64_t ret_ref = (uintptr_t)ret_copy;
19463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19464 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
19465 int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
19469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19470 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
19471 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19472 *ret_copy = COption_u16Z_clone(orig_conv);
19473 int64_t ret_ref = (uintptr_t)ret_copy;
19477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
19478 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19479 *ret_conv = CResult_NoneAPIErrorZ_ok();
19480 return (int64_t)ret_conv;
19483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19484 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19485 CHECK_ACCESS(e_ptr);
19486 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19487 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19488 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19489 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
19490 return (int64_t)ret_conv;
19493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19494 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
19495 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
19499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19500 if ((_res & 1) != 0) return;
19501 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19502 CHECK_ACCESS(_res_ptr);
19503 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
19505 CResult_NoneAPIErrorZ_free(_res_conv);
19508 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
19509 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19510 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
19511 return (int64_t)ret_conv;
19513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19514 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
19515 int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
19519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19520 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
19521 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19522 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
19523 return (int64_t)ret_conv;
19526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19527 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
19528 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19529 if (_res_constr.datalen > 0)
19530 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19532 _res_constr.data = NULL;
19533 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19534 for (size_t w = 0; w < _res_constr.datalen; w++) {
19535 int64_t _res_conv_22 = _res_vals[w];
19536 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
19537 CHECK_ACCESS(_res_conv_22_ptr);
19538 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
19539 FREE((void*)_res_conv_22);
19540 _res_constr.data[w] = _res_conv_22_conv;
19542 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19543 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
19546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19547 LDKCVec_APIErrorZ _res_constr;
19548 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19549 if (_res_constr.datalen > 0)
19550 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19552 _res_constr.data = NULL;
19553 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19554 for (size_t k = 0; k < _res_constr.datalen; k++) {
19555 int64_t _res_conv_10 = _res_vals[k];
19556 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
19557 CHECK_ACCESS(_res_conv_10_ptr);
19558 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
19559 FREE((void*)_res_conv_10);
19560 _res_constr.data[k] = _res_conv_10_conv;
19562 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19563 CVec_APIErrorZ_free(_res_constr);
19566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19567 LDKThirtyTwoBytes o_ref;
19568 CHECK((*env)->GetArrayLength(env, o) == 32);
19569 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19570 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19571 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
19572 return (int64_t)ret_conv;
19575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19576 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19577 CHECK_ACCESS(e_ptr);
19578 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19579 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19580 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19581 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
19582 return (int64_t)ret_conv;
19585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19586 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
19587 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
19591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19592 if ((_res & 1) != 0) return;
19593 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19594 CHECK_ACCESS(_res_ptr);
19595 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
19597 CResult__u832APIErrorZ_free(_res_conv);
19600 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
19601 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19602 *ret_conv = CResult__u832APIErrorZ_clone(arg);
19603 return (int64_t)ret_conv;
19605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19606 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
19607 int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
19611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19612 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
19613 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19614 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
19615 return (int64_t)ret_conv;
19618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19619 LDKThirtyTwoBytes o_ref;
19620 CHECK((*env)->GetArrayLength(env, o) == 32);
19621 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19622 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19623 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
19624 return (int64_t)ret_conv;
19627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19628 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19629 CHECK_ACCESS(e_ptr);
19630 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19631 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19632 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19633 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
19634 return (int64_t)ret_conv;
19637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19638 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
19639 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
19643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19644 if ((_res & 1) != 0) return;
19645 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19646 CHECK_ACCESS(_res_ptr);
19647 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
19649 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
19652 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
19653 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19654 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
19655 return (int64_t)ret_conv;
19657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19658 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
19659 int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
19663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19664 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
19665 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19666 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
19667 return (int64_t)ret_conv;
19670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
19671 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19672 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
19673 return (int64_t)ret_conv;
19676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19677 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19678 CHECK_ACCESS(e_ptr);
19679 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19680 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19681 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19682 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
19683 return (int64_t)ret_conv;
19686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19687 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
19688 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
19692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19693 if ((_res & 1) != 0) return;
19694 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19695 CHECK_ACCESS(_res_ptr);
19696 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
19698 CResult_NonePaymentSendFailureZ_free(_res_conv);
19701 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
19702 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19703 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
19704 return (int64_t)ret_conv;
19706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19707 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
19708 int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
19712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19713 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
19714 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19715 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
19716 return (int64_t)ret_conv;
19719 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
19720 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19721 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
19722 return ((int64_t)ret_conv);
19724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19725 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
19726 int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
19730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19731 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
19732 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19733 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
19734 return ((int64_t)ret_conv);
19737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19738 LDKThirtyTwoBytes a_ref;
19739 CHECK((*env)->GetArrayLength(env, a) == 32);
19740 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19741 LDKThirtyTwoBytes b_ref;
19742 CHECK((*env)->GetArrayLength(env, b) == 32);
19743 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19744 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
19745 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
19746 return ((int64_t)ret_conv);
19749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19750 if ((_res & 1) != 0) return;
19751 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19752 CHECK_ACCESS(_res_ptr);
19753 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
19755 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
19758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19759 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19760 CHECK_ACCESS(o_ptr);
19761 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
19762 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
19763 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19764 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
19765 return (int64_t)ret_conv;
19768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19769 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19770 CHECK_ACCESS(e_ptr);
19771 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
19772 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
19773 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19774 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
19775 return (int64_t)ret_conv;
19778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19779 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
19780 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
19784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19785 if ((_res & 1) != 0) return;
19786 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19787 CHECK_ACCESS(_res_ptr);
19788 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
19790 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
19793 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
19794 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19795 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
19796 return (int64_t)ret_conv;
19798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19799 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
19800 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
19804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19805 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
19806 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19807 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
19808 return (int64_t)ret_conv;
19811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19812 LDKCVec_ThirtyTwoBytesZ _res_constr;
19813 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19814 if (_res_constr.datalen > 0)
19815 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19817 _res_constr.data = NULL;
19818 for (size_t i = 0; i < _res_constr.datalen; i++) {
19819 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19820 LDKThirtyTwoBytes _res_conv_8_ref;
19821 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
19822 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
19823 _res_constr.data[i] = _res_conv_8_ref;
19825 CVec_ThirtyTwoBytesZ_free(_res_constr);
19828 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
19829 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19830 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
19831 return ((int64_t)ret_conv);
19833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19834 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
19835 int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
19839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19840 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
19841 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19842 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
19843 return ((int64_t)ret_conv);
19846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19847 LDKThirtyTwoBytes a_ref;
19848 CHECK((*env)->GetArrayLength(env, a) == 32);
19849 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19850 LDKThirtyTwoBytes b_ref;
19851 CHECK((*env)->GetArrayLength(env, b) == 32);
19852 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19853 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19854 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
19855 return ((int64_t)ret_conv);
19858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19859 if ((_res & 1) != 0) return;
19860 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19861 CHECK_ACCESS(_res_ptr);
19862 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
19864 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
19867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19868 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19869 CHECK_ACCESS(o_ptr);
19870 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19871 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19872 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19873 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
19874 return (int64_t)ret_conv;
19877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
19878 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19879 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
19880 return (int64_t)ret_conv;
19883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19884 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
19885 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
19889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19890 if ((_res & 1) != 0) return;
19891 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19892 CHECK_ACCESS(_res_ptr);
19893 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
19895 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
19898 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
19899 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19900 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
19901 return (int64_t)ret_conv;
19903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19904 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
19905 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
19909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19910 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
19911 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
19912 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
19913 return (int64_t)ret_conv;
19916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19917 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19918 CHECK_ACCESS(o_ptr);
19919 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
19920 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
19921 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19922 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
19923 return (int64_t)ret_conv;
19926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19927 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19928 CHECK_ACCESS(e_ptr);
19929 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19930 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
19931 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19932 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
19933 return (int64_t)ret_conv;
19936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19937 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
19938 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
19942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19943 if ((_res & 1) != 0) return;
19944 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19945 CHECK_ACCESS(_res_ptr);
19946 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
19948 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
19951 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
19952 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19953 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
19954 return (int64_t)ret_conv;
19956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19957 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
19958 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
19962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19963 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
19964 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
19965 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
19966 return (int64_t)ret_conv;
19969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19970 LDKThirtyTwoBytes o_ref;
19971 CHECK((*env)->GetArrayLength(env, o) == 32);
19972 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19973 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19974 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
19975 return (int64_t)ret_conv;
19978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
19979 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
19980 *ret_conv = CResult_PaymentSecretNoneZ_err();
19981 return (int64_t)ret_conv;
19984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19985 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
19986 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
19990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19991 if ((_res & 1) != 0) return;
19992 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19993 CHECK_ACCESS(_res_ptr);
19994 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
19996 CResult_PaymentSecretNoneZ_free(_res_conv);
19999 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
20000 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20001 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
20002 return (int64_t)ret_conv;
20004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20005 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
20006 int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
20010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20011 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
20012 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20013 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
20014 return (int64_t)ret_conv;
20017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20018 LDKThirtyTwoBytes o_ref;
20019 CHECK((*env)->GetArrayLength(env, o) == 32);
20020 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20021 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20022 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
20023 return (int64_t)ret_conv;
20026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20027 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20028 CHECK_ACCESS(e_ptr);
20029 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20030 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
20031 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20032 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
20033 return (int64_t)ret_conv;
20036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20037 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
20038 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
20042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20043 if ((_res & 1) != 0) return;
20044 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20045 CHECK_ACCESS(_res_ptr);
20046 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
20048 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
20051 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
20052 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20053 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
20054 return (int64_t)ret_conv;
20056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20057 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
20058 int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
20062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20063 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
20064 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20065 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
20066 return (int64_t)ret_conv;
20069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20070 LDKThirtyTwoBytes o_ref;
20071 CHECK((*env)->GetArrayLength(env, o) == 32);
20072 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20073 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20074 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
20075 return (int64_t)ret_conv;
20078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20079 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20080 CHECK_ACCESS(e_ptr);
20081 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20082 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
20083 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20084 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
20085 return (int64_t)ret_conv;
20088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20089 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
20090 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
20094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20095 if ((_res & 1) != 0) return;
20096 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20097 CHECK_ACCESS(_res_ptr);
20098 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
20100 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
20103 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
20104 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20105 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
20106 return (int64_t)ret_conv;
20108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20109 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
20110 int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
20114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20115 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
20116 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20117 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
20118 return (int64_t)ret_conv;
20121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20122 LDKCounterpartyForwardingInfo o_conv;
20123 o_conv.inner = (void*)(o & (~1));
20124 o_conv.is_owned = (o & 1) || (o == 0);
20125 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20126 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
20127 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20128 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
20129 return (int64_t)ret_conv;
20132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20133 LDKDecodeError e_conv;
20134 e_conv.inner = (void*)(e & (~1));
20135 e_conv.is_owned = (e & 1) || (e == 0);
20136 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20137 e_conv = DecodeError_clone(&e_conv);
20138 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20139 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
20140 return (int64_t)ret_conv;
20143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20144 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
20145 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
20149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20150 if ((_res & 1) != 0) return;
20151 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20152 CHECK_ACCESS(_res_ptr);
20153 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
20155 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
20158 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
20159 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20160 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
20161 return (int64_t)ret_conv;
20163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20164 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
20165 int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
20169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20170 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
20171 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20172 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
20173 return (int64_t)ret_conv;
20176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20177 LDKChannelCounterparty o_conv;
20178 o_conv.inner = (void*)(o & (~1));
20179 o_conv.is_owned = (o & 1) || (o == 0);
20180 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20181 o_conv = ChannelCounterparty_clone(&o_conv);
20182 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20183 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
20184 return (int64_t)ret_conv;
20187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20188 LDKDecodeError e_conv;
20189 e_conv.inner = (void*)(e & (~1));
20190 e_conv.is_owned = (e & 1) || (e == 0);
20191 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20192 e_conv = DecodeError_clone(&e_conv);
20193 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20194 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
20195 return (int64_t)ret_conv;
20198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20199 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
20200 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
20204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20205 if ((_res & 1) != 0) return;
20206 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20207 CHECK_ACCESS(_res_ptr);
20208 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
20210 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
20213 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
20214 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20215 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
20216 return (int64_t)ret_conv;
20218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20219 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
20220 int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
20224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20225 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
20226 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20227 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
20228 return (int64_t)ret_conv;
20231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20232 LDKChannelDetails o_conv;
20233 o_conv.inner = (void*)(o & (~1));
20234 o_conv.is_owned = (o & 1) || (o == 0);
20235 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20236 o_conv = ChannelDetails_clone(&o_conv);
20237 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20238 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
20239 return (int64_t)ret_conv;
20242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20243 LDKDecodeError e_conv;
20244 e_conv.inner = (void*)(e & (~1));
20245 e_conv.is_owned = (e & 1) || (e == 0);
20246 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20247 e_conv = DecodeError_clone(&e_conv);
20248 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20249 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
20250 return (int64_t)ret_conv;
20253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20254 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
20255 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
20259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20260 if ((_res & 1) != 0) return;
20261 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20262 CHECK_ACCESS(_res_ptr);
20263 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
20265 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
20268 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
20269 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20270 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
20271 return (int64_t)ret_conv;
20273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20274 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
20275 int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
20279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20280 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
20281 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20282 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
20283 return (int64_t)ret_conv;
20286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20287 LDKPhantomRouteHints o_conv;
20288 o_conv.inner = (void*)(o & (~1));
20289 o_conv.is_owned = (o & 1) || (o == 0);
20290 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20291 o_conv = PhantomRouteHints_clone(&o_conv);
20292 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20293 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
20294 return (int64_t)ret_conv;
20297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20298 LDKDecodeError e_conv;
20299 e_conv.inner = (void*)(e & (~1));
20300 e_conv.is_owned = (e & 1) || (e == 0);
20301 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20302 e_conv = DecodeError_clone(&e_conv);
20303 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20304 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
20305 return (int64_t)ret_conv;
20308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20309 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
20310 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
20314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20315 if ((_res & 1) != 0) return;
20316 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20317 CHECK_ACCESS(_res_ptr);
20318 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
20320 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
20323 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
20324 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20325 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
20326 return (int64_t)ret_conv;
20328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20329 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
20330 int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
20334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20335 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
20336 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20337 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
20338 return (int64_t)ret_conv;
20341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20342 LDKCVec_ChannelMonitorZ _res_constr;
20343 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20344 if (_res_constr.datalen > 0)
20345 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
20347 _res_constr.data = NULL;
20348 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20349 for (size_t q = 0; q < _res_constr.datalen; q++) {
20350 int64_t _res_conv_16 = _res_vals[q];
20351 LDKChannelMonitor _res_conv_16_conv;
20352 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
20353 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
20354 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20355 _res_constr.data[q] = _res_conv_16_conv;
20357 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20358 CVec_ChannelMonitorZ_free(_res_constr);
20361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20362 LDKThirtyTwoBytes a_ref;
20363 CHECK((*env)->GetArrayLength(env, a) == 32);
20364 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20365 LDKChannelManager b_conv;
20366 b_conv.inner = (void*)(b & (~1));
20367 b_conv.is_owned = (b & 1) || (b == 0);
20368 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20369 // WARNING: we need a move here but no clone is available for LDKChannelManager
20370 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
20371 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
20372 return ((int64_t)ret_conv);
20375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20376 if ((_res & 1) != 0) return;
20377 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20378 CHECK_ACCESS(_res_ptr);
20379 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
20381 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
20384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20385 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20386 CHECK_ACCESS(o_ptr);
20387 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
20388 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
20389 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20390 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
20391 return (int64_t)ret_conv;
20394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20395 LDKDecodeError e_conv;
20396 e_conv.inner = (void*)(e & (~1));
20397 e_conv.is_owned = (e & 1) || (e == 0);
20398 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20399 e_conv = DecodeError_clone(&e_conv);
20400 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20401 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
20402 return (int64_t)ret_conv;
20405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20406 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
20407 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
20411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20412 if ((_res & 1) != 0) return;
20413 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20414 CHECK_ACCESS(_res_ptr);
20415 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
20417 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
20420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20421 LDKChannelConfig o_conv;
20422 o_conv.inner = (void*)(o & (~1));
20423 o_conv.is_owned = (o & 1) || (o == 0);
20424 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20425 o_conv = ChannelConfig_clone(&o_conv);
20426 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20427 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
20428 return (int64_t)ret_conv;
20431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20432 LDKDecodeError e_conv;
20433 e_conv.inner = (void*)(e & (~1));
20434 e_conv.is_owned = (e & 1) || (e == 0);
20435 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20436 e_conv = DecodeError_clone(&e_conv);
20437 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20438 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
20439 return (int64_t)ret_conv;
20442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20443 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
20444 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
20448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20449 if ((_res & 1) != 0) return;
20450 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20451 CHECK_ACCESS(_res_ptr);
20452 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
20454 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
20457 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
20458 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20459 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
20460 return (int64_t)ret_conv;
20462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20463 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
20464 int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
20468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20469 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
20470 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20471 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
20472 return (int64_t)ret_conv;
20475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20476 LDKOutPoint o_conv;
20477 o_conv.inner = (void*)(o & (~1));
20478 o_conv.is_owned = (o & 1) || (o == 0);
20479 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20480 o_conv = OutPoint_clone(&o_conv);
20481 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20482 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
20483 return (int64_t)ret_conv;
20486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20487 LDKDecodeError e_conv;
20488 e_conv.inner = (void*)(e & (~1));
20489 e_conv.is_owned = (e & 1) || (e == 0);
20490 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20491 e_conv = DecodeError_clone(&e_conv);
20492 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20493 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
20494 return (int64_t)ret_conv;
20497 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20498 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
20499 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
20503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20504 if ((_res & 1) != 0) return;
20505 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20506 CHECK_ACCESS(_res_ptr);
20507 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
20509 CResult_OutPointDecodeErrorZ_free(_res_conv);
20512 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
20513 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20514 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
20515 return (int64_t)ret_conv;
20517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20518 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
20519 int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
20523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20524 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
20525 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20526 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
20527 return (int64_t)ret_conv;
20530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20531 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20532 CHECK_ACCESS(o_ptr);
20533 LDKType o_conv = *(LDKType*)(o_ptr);
20534 if (o_conv.free == LDKType_JCalls_free) {
20535 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20536 LDKType_JCalls_cloned(&o_conv);
20538 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20539 *ret_copy = COption_TypeZ_some(o_conv);
20540 int64_t ret_ref = (uintptr_t)ret_copy;
20544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
20545 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20546 *ret_copy = COption_TypeZ_none();
20547 int64_t ret_ref = (uintptr_t)ret_copy;
20551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20552 if ((_res & 1) != 0) return;
20553 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20554 CHECK_ACCESS(_res_ptr);
20555 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
20557 COption_TypeZ_free(_res_conv);
20560 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
20561 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20562 *ret_copy = COption_TypeZ_clone(arg);
20563 int64_t ret_ref = (uintptr_t)ret_copy;
20566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20567 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
20568 int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
20572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20573 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
20574 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20575 *ret_copy = COption_TypeZ_clone(orig_conv);
20576 int64_t ret_ref = (uintptr_t)ret_copy;
20580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20581 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20582 CHECK_ACCESS(o_ptr);
20583 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
20584 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
20585 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20586 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
20587 return (int64_t)ret_conv;
20590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20591 LDKDecodeError e_conv;
20592 e_conv.inner = (void*)(e & (~1));
20593 e_conv.is_owned = (e & 1) || (e == 0);
20594 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20595 e_conv = DecodeError_clone(&e_conv);
20596 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20597 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
20598 return (int64_t)ret_conv;
20601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20602 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
20603 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
20607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20608 if ((_res & 1) != 0) return;
20609 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20610 CHECK_ACCESS(_res_ptr);
20611 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
20613 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
20616 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
20617 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20618 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
20619 return (int64_t)ret_conv;
20621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20622 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
20623 int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
20627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20628 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
20629 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20630 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
20631 return (int64_t)ret_conv;
20634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20635 LDKThirtyTwoBytes o_ref;
20636 CHECK((*env)->GetArrayLength(env, o) == 32);
20637 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20638 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20639 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
20640 return (int64_t)ret_conv;
20643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20644 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20645 CHECK_ACCESS(e_ptr);
20646 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
20647 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
20648 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20649 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
20650 return (int64_t)ret_conv;
20653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20654 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
20655 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
20659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20660 if ((_res & 1) != 0) return;
20661 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20662 CHECK_ACCESS(_res_ptr);
20663 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
20665 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
20668 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
20669 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20670 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
20671 return (int64_t)ret_conv;
20673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20674 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
20675 int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
20679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20680 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
20681 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
20682 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
20683 return (int64_t)ret_conv;
20686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
20687 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
20688 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20689 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
20690 return (int64_t)ret_conv;
20693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20694 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20695 CHECK_ACCESS(e_ptr);
20696 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
20697 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
20698 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20699 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
20700 return (int64_t)ret_conv;
20703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20704 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
20705 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
20709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20710 if ((_res & 1) != 0) return;
20711 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20712 CHECK_ACCESS(_res_ptr);
20713 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
20715 CResult_SiPrefixParseErrorZ_free(_res_conv);
20718 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
20719 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20720 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
20721 return (int64_t)ret_conv;
20723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20724 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
20725 int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
20729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20730 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
20731 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
20732 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
20733 return (int64_t)ret_conv;
20736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20738 o_conv.inner = (void*)(o & (~1));
20739 o_conv.is_owned = (o & 1) || (o == 0);
20740 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20741 o_conv = Invoice_clone(&o_conv);
20742 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20743 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
20744 return (int64_t)ret_conv;
20747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20748 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20749 CHECK_ACCESS(e_ptr);
20750 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
20751 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
20752 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20753 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
20754 return (int64_t)ret_conv;
20757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20758 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
20759 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
20763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20764 if ((_res & 1) != 0) return;
20765 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20766 CHECK_ACCESS(_res_ptr);
20767 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
20769 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
20772 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
20773 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20774 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
20775 return (int64_t)ret_conv;
20777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20778 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
20779 int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
20783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20784 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
20785 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
20786 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
20787 return (int64_t)ret_conv;
20790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20791 LDKSignedRawInvoice o_conv;
20792 o_conv.inner = (void*)(o & (~1));
20793 o_conv.is_owned = (o & 1) || (o == 0);
20794 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20795 o_conv = SignedRawInvoice_clone(&o_conv);
20796 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20797 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
20798 return (int64_t)ret_conv;
20801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20802 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20803 CHECK_ACCESS(e_ptr);
20804 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
20805 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
20806 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20807 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
20808 return (int64_t)ret_conv;
20811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20812 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
20813 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
20817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20818 if ((_res & 1) != 0) return;
20819 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20820 CHECK_ACCESS(_res_ptr);
20821 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
20823 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
20826 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
20827 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20828 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
20829 return (int64_t)ret_conv;
20831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20832 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
20833 int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
20837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20838 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
20839 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
20840 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
20841 return (int64_t)ret_conv;
20844 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
20845 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20846 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
20847 return ((int64_t)ret_conv);
20849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20850 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
20851 int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
20855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20856 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
20857 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20858 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
20859 return ((int64_t)ret_conv);
20862 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) {
20863 LDKRawInvoice a_conv;
20864 a_conv.inner = (void*)(a & (~1));
20865 a_conv.is_owned = (a & 1) || (a == 0);
20866 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20867 a_conv = RawInvoice_clone(&a_conv);
20868 LDKThirtyTwoBytes b_ref;
20869 CHECK((*env)->GetArrayLength(env, b) == 32);
20870 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
20871 LDKInvoiceSignature c_conv;
20872 c_conv.inner = (void*)(c & (~1));
20873 c_conv.is_owned = (c & 1) || (c == 0);
20874 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20875 c_conv = InvoiceSignature_clone(&c_conv);
20876 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
20877 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
20878 return ((int64_t)ret_conv);
20881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20882 if ((_res & 1) != 0) return;
20883 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20884 CHECK_ACCESS(_res_ptr);
20885 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
20887 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
20890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20891 LDKPayeePubKey o_conv;
20892 o_conv.inner = (void*)(o & (~1));
20893 o_conv.is_owned = (o & 1) || (o == 0);
20894 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20895 o_conv = PayeePubKey_clone(&o_conv);
20896 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20897 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
20898 return (int64_t)ret_conv;
20901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20902 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20903 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20904 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
20905 return (int64_t)ret_conv;
20908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20909 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
20910 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
20914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20915 if ((_res & 1) != 0) return;
20916 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20917 CHECK_ACCESS(_res_ptr);
20918 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
20920 CResult_PayeePubKeyErrorZ_free(_res_conv);
20923 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
20924 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20925 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
20926 return (int64_t)ret_conv;
20928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20929 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
20930 int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
20934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20935 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
20936 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
20937 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
20938 return (int64_t)ret_conv;
20941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20942 LDKCVec_PrivateRouteZ _res_constr;
20943 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20944 if (_res_constr.datalen > 0)
20945 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
20947 _res_constr.data = NULL;
20948 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20949 for (size_t o = 0; o < _res_constr.datalen; o++) {
20950 int64_t _res_conv_14 = _res_vals[o];
20951 LDKPrivateRoute _res_conv_14_conv;
20952 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
20953 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
20954 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
20955 _res_constr.data[o] = _res_conv_14_conv;
20957 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20958 CVec_PrivateRouteZ_free(_res_constr);
20961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20962 LDKPositiveTimestamp o_conv;
20963 o_conv.inner = (void*)(o & (~1));
20964 o_conv.is_owned = (o & 1) || (o == 0);
20965 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20966 o_conv = PositiveTimestamp_clone(&o_conv);
20967 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20968 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
20969 return (int64_t)ret_conv;
20972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20973 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20974 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20975 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
20976 return (int64_t)ret_conv;
20979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20980 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
20981 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
20985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20986 if ((_res & 1) != 0) return;
20987 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20988 CHECK_ACCESS(_res_ptr);
20989 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
20991 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
20994 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
20995 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
20996 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
20997 return (int64_t)ret_conv;
20999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21000 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
21001 int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
21005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21006 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
21007 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
21008 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
21009 return (int64_t)ret_conv;
21012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
21013 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21014 *ret_conv = CResult_NoneSemanticErrorZ_ok();
21015 return (int64_t)ret_conv;
21018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21019 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
21020 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21021 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
21022 return (int64_t)ret_conv;
21025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21026 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
21027 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
21031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21032 if ((_res & 1) != 0) return;
21033 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21034 CHECK_ACCESS(_res_ptr);
21035 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
21037 CResult_NoneSemanticErrorZ_free(_res_conv);
21040 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
21041 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21042 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
21043 return (int64_t)ret_conv;
21045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21046 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
21047 int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
21051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21052 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
21053 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21054 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
21055 return (int64_t)ret_conv;
21058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21060 o_conv.inner = (void*)(o & (~1));
21061 o_conv.is_owned = (o & 1) || (o == 0);
21062 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21063 o_conv = Invoice_clone(&o_conv);
21064 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21065 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
21066 return (int64_t)ret_conv;
21069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21070 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
21071 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21072 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
21073 return (int64_t)ret_conv;
21076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21077 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
21078 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
21082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21083 if ((_res & 1) != 0) return;
21084 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21085 CHECK_ACCESS(_res_ptr);
21086 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
21088 CResult_InvoiceSemanticErrorZ_free(_res_conv);
21091 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
21092 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21093 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
21094 return (int64_t)ret_conv;
21096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21097 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
21098 int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
21102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21103 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
21104 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21105 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
21106 return (int64_t)ret_conv;
21109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21110 LDKDescription o_conv;
21111 o_conv.inner = (void*)(o & (~1));
21112 o_conv.is_owned = (o & 1) || (o == 0);
21113 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21114 o_conv = Description_clone(&o_conv);
21115 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21116 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
21117 return (int64_t)ret_conv;
21120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21121 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
21122 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21123 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
21124 return (int64_t)ret_conv;
21127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21128 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
21129 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
21133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21134 if ((_res & 1) != 0) return;
21135 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21136 CHECK_ACCESS(_res_ptr);
21137 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
21139 CResult_DescriptionCreationErrorZ_free(_res_conv);
21142 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
21143 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21144 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
21145 return (int64_t)ret_conv;
21147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21148 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
21149 int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
21153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21154 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
21155 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21156 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
21157 return (int64_t)ret_conv;
21160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21161 LDKPrivateRoute o_conv;
21162 o_conv.inner = (void*)(o & (~1));
21163 o_conv.is_owned = (o & 1) || (o == 0);
21164 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21165 o_conv = PrivateRoute_clone(&o_conv);
21166 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21167 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
21168 return (int64_t)ret_conv;
21171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21172 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
21173 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21174 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
21175 return (int64_t)ret_conv;
21178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21179 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
21180 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
21184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21185 if ((_res & 1) != 0) return;
21186 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21187 CHECK_ACCESS(_res_ptr);
21188 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
21190 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
21193 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
21194 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21195 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
21196 return (int64_t)ret_conv;
21198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21199 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
21200 int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
21204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21205 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
21206 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21207 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
21208 return (int64_t)ret_conv;
21211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
21212 LDKStr o_conv = java_to_owned_str(env, o);
21213 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21214 *ret_conv = CResult_StringErrorZ_ok(o_conv);
21215 return (int64_t)ret_conv;
21218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21219 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
21220 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21221 *ret_conv = CResult_StringErrorZ_err(e_conv);
21222 return (int64_t)ret_conv;
21225 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21226 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
21227 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
21231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21232 if ((_res & 1) != 0) return;
21233 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21234 CHECK_ACCESS(_res_ptr);
21235 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
21237 CResult_StringErrorZ_free(_res_conv);
21240 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
21241 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21242 *ret_conv = CResult_StringErrorZ_clone(arg);
21243 return (int64_t)ret_conv;
21245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21246 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
21247 int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
21251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21252 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
21253 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21254 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
21255 return (int64_t)ret_conv;
21258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21259 LDKChannelMonitorUpdate o_conv;
21260 o_conv.inner = (void*)(o & (~1));
21261 o_conv.is_owned = (o & 1) || (o == 0);
21262 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21263 o_conv = ChannelMonitorUpdate_clone(&o_conv);
21264 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21265 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
21266 return (int64_t)ret_conv;
21269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21270 LDKDecodeError e_conv;
21271 e_conv.inner = (void*)(e & (~1));
21272 e_conv.is_owned = (e & 1) || (e == 0);
21273 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21274 e_conv = DecodeError_clone(&e_conv);
21275 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21276 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
21277 return (int64_t)ret_conv;
21280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21281 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
21282 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
21286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21287 if ((_res & 1) != 0) return;
21288 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21289 CHECK_ACCESS(_res_ptr);
21290 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
21292 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
21295 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
21296 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21297 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
21298 return (int64_t)ret_conv;
21300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21301 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
21302 int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
21306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21307 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
21308 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21309 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
21310 return (int64_t)ret_conv;
21313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21314 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21315 CHECK_ACCESS(o_ptr);
21316 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
21317 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
21318 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21319 *ret_copy = COption_MonitorEventZ_some(o_conv);
21320 int64_t ret_ref = (uintptr_t)ret_copy;
21324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
21325 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21326 *ret_copy = COption_MonitorEventZ_none();
21327 int64_t ret_ref = (uintptr_t)ret_copy;
21331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21332 if ((_res & 1) != 0) return;
21333 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21334 CHECK_ACCESS(_res_ptr);
21335 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
21337 COption_MonitorEventZ_free(_res_conv);
21340 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
21341 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21342 *ret_copy = COption_MonitorEventZ_clone(arg);
21343 int64_t ret_ref = (uintptr_t)ret_copy;
21346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21347 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
21348 int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
21352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21353 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
21354 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21355 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
21356 int64_t ret_ref = (uintptr_t)ret_copy;
21360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21361 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21362 CHECK_ACCESS(o_ptr);
21363 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
21364 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
21365 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21366 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
21367 return (int64_t)ret_conv;
21370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21371 LDKDecodeError e_conv;
21372 e_conv.inner = (void*)(e & (~1));
21373 e_conv.is_owned = (e & 1) || (e == 0);
21374 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21375 e_conv = DecodeError_clone(&e_conv);
21376 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21377 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
21378 return (int64_t)ret_conv;
21381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21382 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
21383 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
21387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21388 if ((_res & 1) != 0) return;
21389 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21390 CHECK_ACCESS(_res_ptr);
21391 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
21393 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
21396 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
21397 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21398 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
21399 return (int64_t)ret_conv;
21401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21402 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
21403 int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
21407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21408 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
21409 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21410 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
21411 return (int64_t)ret_conv;
21414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21415 LDKHTLCUpdate o_conv;
21416 o_conv.inner = (void*)(o & (~1));
21417 o_conv.is_owned = (o & 1) || (o == 0);
21418 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21419 o_conv = HTLCUpdate_clone(&o_conv);
21420 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21421 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
21422 return (int64_t)ret_conv;
21425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21426 LDKDecodeError e_conv;
21427 e_conv.inner = (void*)(e & (~1));
21428 e_conv.is_owned = (e & 1) || (e == 0);
21429 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21430 e_conv = DecodeError_clone(&e_conv);
21431 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21432 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
21433 return (int64_t)ret_conv;
21436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21437 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
21438 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21443 if ((_res & 1) != 0) return;
21444 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21445 CHECK_ACCESS(_res_ptr);
21446 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21448 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21451 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21452 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21453 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21454 return (int64_t)ret_conv;
21456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21457 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
21458 int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21463 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
21464 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21465 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21466 return (int64_t)ret_conv;
21469 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
21470 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21471 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
21472 return ((int64_t)ret_conv);
21474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21475 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
21476 int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
21480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21481 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
21482 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21483 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
21484 return ((int64_t)ret_conv);
21487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
21488 LDKOutPoint a_conv;
21489 a_conv.inner = (void*)(a & (~1));
21490 a_conv.is_owned = (a & 1) || (a == 0);
21491 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21492 a_conv = OutPoint_clone(&a_conv);
21494 b_ref.datalen = (*env)->GetArrayLength(env, b);
21495 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21496 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21497 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21498 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
21499 return ((int64_t)ret_conv);
21502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21503 if ((_res & 1) != 0) return;
21504 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21505 CHECK_ACCESS(_res_ptr);
21506 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
21508 C2Tuple_OutPointScriptZ_free(_res_conv);
21511 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
21512 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21513 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
21514 return ((int64_t)ret_conv);
21516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21517 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
21518 int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
21522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21523 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
21524 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21525 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
21526 return ((int64_t)ret_conv);
21529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
21531 b_ref.datalen = (*env)->GetArrayLength(env, b);
21532 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21533 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21534 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21535 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
21536 return ((int64_t)ret_conv);
21539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21540 if ((_res & 1) != 0) return;
21541 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21542 CHECK_ACCESS(_res_ptr);
21543 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
21545 C2Tuple_u32ScriptZ_free(_res_conv);
21548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21549 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
21550 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21551 if (_res_constr.datalen > 0)
21552 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
21554 _res_constr.data = NULL;
21555 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21556 for (size_t v = 0; v < _res_constr.datalen; v++) {
21557 int64_t _res_conv_21 = _res_vals[v];
21558 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
21559 CHECK_ACCESS(_res_conv_21_ptr);
21560 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
21561 FREE((void*)_res_conv_21);
21562 _res_constr.data[v] = _res_conv_21_conv;
21564 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21565 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
21568 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
21569 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21570 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
21571 return ((int64_t)ret_conv);
21573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21574 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
21575 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
21579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21580 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
21581 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21582 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
21583 return ((int64_t)ret_conv);
21586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
21587 LDKThirtyTwoBytes a_ref;
21588 CHECK((*env)->GetArrayLength(env, a) == 32);
21589 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21590 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
21591 b_constr.datalen = (*env)->GetArrayLength(env, b);
21592 if (b_constr.datalen > 0)
21593 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
21595 b_constr.data = NULL;
21596 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
21597 for (size_t v = 0; v < b_constr.datalen; v++) {
21598 int64_t b_conv_21 = b_vals[v];
21599 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
21600 CHECK_ACCESS(b_conv_21_ptr);
21601 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
21602 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
21603 b_constr.data[v] = b_conv_21_conv;
21605 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
21606 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
21607 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
21608 return ((int64_t)ret_conv);
21611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21612 if ((_res & 1) != 0) return;
21613 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21614 CHECK_ACCESS(_res_ptr);
21615 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
21617 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
21620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21621 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
21622 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21623 if (_res_constr.datalen > 0)
21624 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
21626 _res_constr.data = NULL;
21627 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21628 for (size_t o = 0; o < _res_constr.datalen; o++) {
21629 int64_t _res_conv_40 = _res_vals[o];
21630 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
21631 CHECK_ACCESS(_res_conv_40_ptr);
21632 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
21633 FREE((void*)_res_conv_40);
21634 _res_constr.data[o] = _res_conv_40_conv;
21636 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21637 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
21640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21641 LDKCVec_EventZ _res_constr;
21642 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21643 if (_res_constr.datalen > 0)
21644 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
21646 _res_constr.data = NULL;
21647 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21648 for (size_t h = 0; h < _res_constr.datalen; h++) {
21649 int64_t _res_conv_7 = _res_vals[h];
21650 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
21651 CHECK_ACCESS(_res_conv_7_ptr);
21652 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
21653 FREE((void*)_res_conv_7);
21654 _res_constr.data[h] = _res_conv_7_conv;
21656 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21657 CVec_EventZ_free(_res_constr);
21660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21661 LDKCVec_TransactionZ _res_constr;
21662 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21663 if (_res_constr.datalen > 0)
21664 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
21666 _res_constr.data = NULL;
21667 for (size_t i = 0; i < _res_constr.datalen; i++) {
21668 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21669 LDKTransaction _res_conv_8_ref;
21670 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
21671 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
21672 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
21673 _res_conv_8_ref.data_is_owned = true;
21674 _res_constr.data[i] = _res_conv_8_ref;
21676 CVec_TransactionZ_free(_res_constr);
21679 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
21680 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21681 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
21682 return ((int64_t)ret_conv);
21684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21685 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
21686 int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
21690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21691 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
21692 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21693 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
21694 return ((int64_t)ret_conv);
21697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
21698 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
21699 CHECK_ACCESS(b_ptr);
21700 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
21701 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
21702 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21703 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
21704 return ((int64_t)ret_conv);
21707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21708 if ((_res & 1) != 0) return;
21709 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21710 CHECK_ACCESS(_res_ptr);
21711 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
21713 C2Tuple_u32TxOutZ_free(_res_conv);
21716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21717 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
21718 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21719 if (_res_constr.datalen > 0)
21720 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21722 _res_constr.data = NULL;
21723 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21724 for (size_t u = 0; u < _res_constr.datalen; u++) {
21725 int64_t _res_conv_20 = _res_vals[u];
21726 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
21727 CHECK_ACCESS(_res_conv_20_ptr);
21728 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
21729 FREE((void*)_res_conv_20);
21730 _res_constr.data[u] = _res_conv_20_conv;
21732 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21733 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
21736 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
21737 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21738 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
21739 return ((int64_t)ret_conv);
21741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21742 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
21743 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
21747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21748 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
21749 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21750 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
21751 return ((int64_t)ret_conv);
21754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
21755 LDKThirtyTwoBytes a_ref;
21756 CHECK((*env)->GetArrayLength(env, a) == 32);
21757 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21758 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
21759 b_constr.datalen = (*env)->GetArrayLength(env, b);
21760 if (b_constr.datalen > 0)
21761 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21763 b_constr.data = NULL;
21764 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
21765 for (size_t u = 0; u < b_constr.datalen; u++) {
21766 int64_t b_conv_20 = b_vals[u];
21767 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
21768 CHECK_ACCESS(b_conv_20_ptr);
21769 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
21770 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
21771 b_constr.data[u] = b_conv_20_conv;
21773 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
21774 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
21775 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
21776 return ((int64_t)ret_conv);
21779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21780 if ((_res & 1) != 0) return;
21781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21782 CHECK_ACCESS(_res_ptr);
21783 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
21785 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
21788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21789 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
21790 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21791 if (_res_constr.datalen > 0)
21792 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
21794 _res_constr.data = NULL;
21795 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21796 for (size_t n = 0; n < _res_constr.datalen; n++) {
21797 int64_t _res_conv_39 = _res_vals[n];
21798 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
21799 CHECK_ACCESS(_res_conv_39_ptr);
21800 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
21801 FREE((void*)_res_conv_39);
21802 _res_constr.data[n] = _res_conv_39_conv;
21804 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21805 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
21808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21809 LDKCVec_BalanceZ _res_constr;
21810 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21811 if (_res_constr.datalen > 0)
21812 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
21814 _res_constr.data = NULL;
21815 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21816 for (size_t j = 0; j < _res_constr.datalen; j++) {
21817 int64_t _res_conv_9 = _res_vals[j];
21818 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
21819 CHECK_ACCESS(_res_conv_9_ptr);
21820 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
21821 FREE((void*)_res_conv_9);
21822 _res_constr.data[j] = _res_conv_9_conv;
21824 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21825 CVec_BalanceZ_free(_res_constr);
21828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21829 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21830 CHECK_ACCESS(o_ptr);
21831 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
21832 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
21833 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21834 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
21835 return (int64_t)ret_conv;
21838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21839 LDKDecodeError e_conv;
21840 e_conv.inner = (void*)(e & (~1));
21841 e_conv.is_owned = (e & 1) || (e == 0);
21842 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21843 e_conv = DecodeError_clone(&e_conv);
21844 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21845 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
21846 return (int64_t)ret_conv;
21849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21850 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
21851 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
21855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21856 if ((_res & 1) != 0) return;
21857 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21858 CHECK_ACCESS(_res_ptr);
21859 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
21861 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
21864 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
21865 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21866 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
21867 return (int64_t)ret_conv;
21869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21870 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
21871 int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
21875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21876 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
21877 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
21878 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
21879 return (int64_t)ret_conv;
21882 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
21883 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21884 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
21885 return ((int64_t)ret_conv);
21887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21888 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
21889 int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
21893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21894 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
21895 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21896 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
21897 return ((int64_t)ret_conv);
21900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21901 LDKPublicKey a_ref;
21902 CHECK((*env)->GetArrayLength(env, a) == 33);
21903 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
21904 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
21905 CHECK_ACCESS(b_ptr);
21906 LDKType b_conv = *(LDKType*)(b_ptr);
21907 if (b_conv.free == LDKType_JCalls_free) {
21908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21909 LDKType_JCalls_cloned(&b_conv);
21911 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21912 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
21913 return ((int64_t)ret_conv);
21916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21917 if ((_res & 1) != 0) return;
21918 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21919 CHECK_ACCESS(_res_ptr);
21920 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
21922 C2Tuple_PublicKeyTypeZ_free(_res_conv);
21925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21926 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
21927 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21928 if (_res_constr.datalen > 0)
21929 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
21931 _res_constr.data = NULL;
21932 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21933 for (size_t z = 0; z < _res_constr.datalen; z++) {
21934 int64_t _res_conv_25 = _res_vals[z];
21935 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
21936 CHECK_ACCESS(_res_conv_25_ptr);
21937 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
21938 FREE((void*)_res_conv_25);
21939 _res_constr.data[z] = _res_conv_25_conv;
21941 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21942 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
21945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21946 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21947 CHECK_ACCESS(o_ptr);
21948 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21949 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
21950 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21951 *ret_copy = COption_NetAddressZ_some(o_conv);
21952 int64_t ret_ref = (uintptr_t)ret_copy;
21956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
21957 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21958 *ret_copy = COption_NetAddressZ_none();
21959 int64_t ret_ref = (uintptr_t)ret_copy;
21963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21964 if ((_res & 1) != 0) return;
21965 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21966 CHECK_ACCESS(_res_ptr);
21967 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
21969 COption_NetAddressZ_free(_res_conv);
21972 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
21973 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21974 *ret_copy = COption_NetAddressZ_clone(arg);
21975 int64_t ret_ref = (uintptr_t)ret_copy;
21978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21979 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
21980 int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
21984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21985 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
21986 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
21987 *ret_copy = COption_NetAddressZ_clone(orig_conv);
21988 int64_t ret_ref = (uintptr_t)ret_copy;
21992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21994 o_ref.datalen = (*env)->GetArrayLength(env, o);
21995 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21996 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21997 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21998 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
21999 return (int64_t)ret_conv;
22002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22003 LDKPeerHandleError e_conv;
22004 e_conv.inner = (void*)(e & (~1));
22005 e_conv.is_owned = (e & 1) || (e == 0);
22006 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22007 e_conv = PeerHandleError_clone(&e_conv);
22008 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22009 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
22010 return (int64_t)ret_conv;
22013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22014 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
22015 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
22019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22020 if ((_res & 1) != 0) return;
22021 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22022 CHECK_ACCESS(_res_ptr);
22023 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
22025 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
22028 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
22029 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22030 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
22031 return (int64_t)ret_conv;
22033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22034 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
22035 int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
22039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22040 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
22041 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22042 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
22043 return (int64_t)ret_conv;
22046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
22047 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22048 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
22049 return (int64_t)ret_conv;
22052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22053 LDKPeerHandleError e_conv;
22054 e_conv.inner = (void*)(e & (~1));
22055 e_conv.is_owned = (e & 1) || (e == 0);
22056 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22057 e_conv = PeerHandleError_clone(&e_conv);
22058 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22059 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
22060 return (int64_t)ret_conv;
22063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22064 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
22065 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
22069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22070 if ((_res & 1) != 0) return;
22071 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22072 CHECK_ACCESS(_res_ptr);
22073 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
22075 CResult_NonePeerHandleErrorZ_free(_res_conv);
22078 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
22079 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22080 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
22081 return (int64_t)ret_conv;
22083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22084 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
22085 int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
22089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22090 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
22091 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22092 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
22093 return (int64_t)ret_conv;
22096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
22097 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22098 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
22099 return (int64_t)ret_conv;
22102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22103 LDKPeerHandleError e_conv;
22104 e_conv.inner = (void*)(e & (~1));
22105 e_conv.is_owned = (e & 1) || (e == 0);
22106 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22107 e_conv = PeerHandleError_clone(&e_conv);
22108 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22109 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
22110 return (int64_t)ret_conv;
22113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22114 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
22115 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
22119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22120 if ((_res & 1) != 0) return;
22121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22122 CHECK_ACCESS(_res_ptr);
22123 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
22125 CResult_boolPeerHandleErrorZ_free(_res_conv);
22128 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
22129 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22130 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
22131 return (int64_t)ret_conv;
22133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22134 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
22135 int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
22139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22140 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
22141 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22142 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
22143 return (int64_t)ret_conv;
22146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
22147 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22148 *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
22149 return (int64_t)ret_conv;
22152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22153 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
22154 CHECK_ACCESS(e_ptr);
22155 LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
22156 e_conv = GraphSyncError_clone((LDKGraphSyncError*)(((uintptr_t)e) & ~1));
22157 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22158 *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
22159 return (int64_t)ret_conv;
22162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22163 LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)(o & ~1);
22164 jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
22168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22169 if ((_res & 1) != 0) return;
22170 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22171 CHECK_ACCESS(_res_ptr);
22172 LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
22174 CResult_u32GraphSyncErrorZ_free(_res_conv);
22177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22178 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
22179 CHECK_ACCESS(o_ptr);
22180 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
22181 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
22182 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22183 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
22184 return (int64_t)ret_conv;
22187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22188 LDKDecodeError e_conv;
22189 e_conv.inner = (void*)(e & (~1));
22190 e_conv.is_owned = (e & 1) || (e == 0);
22191 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22192 e_conv = DecodeError_clone(&e_conv);
22193 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22194 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
22195 return (int64_t)ret_conv;
22198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22199 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
22200 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
22204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22205 if ((_res & 1) != 0) return;
22206 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22207 CHECK_ACCESS(_res_ptr);
22208 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
22210 CResult_NetAddressDecodeErrorZ_free(_res_conv);
22213 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
22214 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22215 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
22216 return (int64_t)ret_conv;
22218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22219 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
22220 int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
22224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22225 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
22226 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22227 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
22228 return (int64_t)ret_conv;
22231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22232 LDKCVec_UpdateAddHTLCZ _res_constr;
22233 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22234 if (_res_constr.datalen > 0)
22235 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
22237 _res_constr.data = NULL;
22238 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22239 for (size_t p = 0; p < _res_constr.datalen; p++) {
22240 int64_t _res_conv_15 = _res_vals[p];
22241 LDKUpdateAddHTLC _res_conv_15_conv;
22242 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
22243 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
22244 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
22245 _res_constr.data[p] = _res_conv_15_conv;
22247 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22248 CVec_UpdateAddHTLCZ_free(_res_constr);
22251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22252 LDKCVec_UpdateFulfillHTLCZ _res_constr;
22253 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22254 if (_res_constr.datalen > 0)
22255 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
22257 _res_constr.data = NULL;
22258 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22259 for (size_t t = 0; t < _res_constr.datalen; t++) {
22260 int64_t _res_conv_19 = _res_vals[t];
22261 LDKUpdateFulfillHTLC _res_conv_19_conv;
22262 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
22263 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
22264 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22265 _res_constr.data[t] = _res_conv_19_conv;
22267 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22268 CVec_UpdateFulfillHTLCZ_free(_res_constr);
22271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22272 LDKCVec_UpdateFailHTLCZ _res_constr;
22273 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22274 if (_res_constr.datalen > 0)
22275 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
22277 _res_constr.data = NULL;
22278 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22279 for (size_t q = 0; q < _res_constr.datalen; q++) {
22280 int64_t _res_conv_16 = _res_vals[q];
22281 LDKUpdateFailHTLC _res_conv_16_conv;
22282 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
22283 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
22284 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22285 _res_constr.data[q] = _res_conv_16_conv;
22287 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22288 CVec_UpdateFailHTLCZ_free(_res_constr);
22291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22292 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
22293 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22294 if (_res_constr.datalen > 0)
22295 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
22297 _res_constr.data = NULL;
22298 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22299 for (size_t z = 0; z < _res_constr.datalen; z++) {
22300 int64_t _res_conv_25 = _res_vals[z];
22301 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
22302 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
22303 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
22304 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
22305 _res_constr.data[z] = _res_conv_25_conv;
22307 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22308 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
22311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22312 LDKAcceptChannel o_conv;
22313 o_conv.inner = (void*)(o & (~1));
22314 o_conv.is_owned = (o & 1) || (o == 0);
22315 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22316 o_conv = AcceptChannel_clone(&o_conv);
22317 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22318 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
22319 return (int64_t)ret_conv;
22322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22323 LDKDecodeError e_conv;
22324 e_conv.inner = (void*)(e & (~1));
22325 e_conv.is_owned = (e & 1) || (e == 0);
22326 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22327 e_conv = DecodeError_clone(&e_conv);
22328 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22329 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
22330 return (int64_t)ret_conv;
22333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22334 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
22335 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
22339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22340 if ((_res & 1) != 0) return;
22341 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22342 CHECK_ACCESS(_res_ptr);
22343 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
22345 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
22348 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
22349 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22350 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
22351 return (int64_t)ret_conv;
22353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22354 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
22355 int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
22359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22360 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
22361 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22362 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
22363 return (int64_t)ret_conv;
22366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22367 LDKAnnouncementSignatures o_conv;
22368 o_conv.inner = (void*)(o & (~1));
22369 o_conv.is_owned = (o & 1) || (o == 0);
22370 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22371 o_conv = AnnouncementSignatures_clone(&o_conv);
22372 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22373 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
22374 return (int64_t)ret_conv;
22377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22378 LDKDecodeError e_conv;
22379 e_conv.inner = (void*)(e & (~1));
22380 e_conv.is_owned = (e & 1) || (e == 0);
22381 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22382 e_conv = DecodeError_clone(&e_conv);
22383 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22384 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
22385 return (int64_t)ret_conv;
22388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22389 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
22390 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
22394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22395 if ((_res & 1) != 0) return;
22396 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22397 CHECK_ACCESS(_res_ptr);
22398 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
22400 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
22403 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
22404 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22405 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
22406 return (int64_t)ret_conv;
22408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22409 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
22410 int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
22414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22415 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
22416 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22417 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
22418 return (int64_t)ret_conv;
22421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22422 LDKChannelReestablish o_conv;
22423 o_conv.inner = (void*)(o & (~1));
22424 o_conv.is_owned = (o & 1) || (o == 0);
22425 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22426 o_conv = ChannelReestablish_clone(&o_conv);
22427 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22428 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
22429 return (int64_t)ret_conv;
22432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22433 LDKDecodeError e_conv;
22434 e_conv.inner = (void*)(e & (~1));
22435 e_conv.is_owned = (e & 1) || (e == 0);
22436 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22437 e_conv = DecodeError_clone(&e_conv);
22438 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22439 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
22440 return (int64_t)ret_conv;
22443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22444 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
22445 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
22449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22450 if ((_res & 1) != 0) return;
22451 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22452 CHECK_ACCESS(_res_ptr);
22453 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
22455 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
22458 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
22459 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22460 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
22461 return (int64_t)ret_conv;
22463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22464 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
22465 int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
22469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22470 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
22471 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22472 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
22473 return (int64_t)ret_conv;
22476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22477 LDKClosingSigned o_conv;
22478 o_conv.inner = (void*)(o & (~1));
22479 o_conv.is_owned = (o & 1) || (o == 0);
22480 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22481 o_conv = ClosingSigned_clone(&o_conv);
22482 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22483 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
22484 return (int64_t)ret_conv;
22487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22488 LDKDecodeError e_conv;
22489 e_conv.inner = (void*)(e & (~1));
22490 e_conv.is_owned = (e & 1) || (e == 0);
22491 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22492 e_conv = DecodeError_clone(&e_conv);
22493 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22494 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
22495 return (int64_t)ret_conv;
22498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22499 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
22500 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
22504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22505 if ((_res & 1) != 0) return;
22506 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22507 CHECK_ACCESS(_res_ptr);
22508 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
22510 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
22513 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
22514 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22515 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
22516 return (int64_t)ret_conv;
22518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22519 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
22520 int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
22524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22525 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
22526 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22527 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
22528 return (int64_t)ret_conv;
22531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22532 LDKClosingSignedFeeRange o_conv;
22533 o_conv.inner = (void*)(o & (~1));
22534 o_conv.is_owned = (o & 1) || (o == 0);
22535 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22536 o_conv = ClosingSignedFeeRange_clone(&o_conv);
22537 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22538 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
22539 return (int64_t)ret_conv;
22542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22543 LDKDecodeError e_conv;
22544 e_conv.inner = (void*)(e & (~1));
22545 e_conv.is_owned = (e & 1) || (e == 0);
22546 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22547 e_conv = DecodeError_clone(&e_conv);
22548 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22549 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
22550 return (int64_t)ret_conv;
22553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22554 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
22555 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
22559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22560 if ((_res & 1) != 0) return;
22561 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22562 CHECK_ACCESS(_res_ptr);
22563 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
22565 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
22568 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
22569 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22570 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
22571 return (int64_t)ret_conv;
22573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22574 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
22575 int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
22579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22580 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
22581 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
22582 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
22583 return (int64_t)ret_conv;
22586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22587 LDKCommitmentSigned o_conv;
22588 o_conv.inner = (void*)(o & (~1));
22589 o_conv.is_owned = (o & 1) || (o == 0);
22590 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22591 o_conv = CommitmentSigned_clone(&o_conv);
22592 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22593 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
22594 return (int64_t)ret_conv;
22597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22598 LDKDecodeError e_conv;
22599 e_conv.inner = (void*)(e & (~1));
22600 e_conv.is_owned = (e & 1) || (e == 0);
22601 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22602 e_conv = DecodeError_clone(&e_conv);
22603 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22604 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
22605 return (int64_t)ret_conv;
22608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22609 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
22610 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
22614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22615 if ((_res & 1) != 0) return;
22616 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22617 CHECK_ACCESS(_res_ptr);
22618 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
22620 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
22623 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
22624 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22625 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
22626 return (int64_t)ret_conv;
22628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22629 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
22630 int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
22634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22635 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
22636 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
22637 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
22638 return (int64_t)ret_conv;
22641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22642 LDKFundingCreated o_conv;
22643 o_conv.inner = (void*)(o & (~1));
22644 o_conv.is_owned = (o & 1) || (o == 0);
22645 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22646 o_conv = FundingCreated_clone(&o_conv);
22647 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22648 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
22649 return (int64_t)ret_conv;
22652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22653 LDKDecodeError e_conv;
22654 e_conv.inner = (void*)(e & (~1));
22655 e_conv.is_owned = (e & 1) || (e == 0);
22656 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22657 e_conv = DecodeError_clone(&e_conv);
22658 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22659 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
22660 return (int64_t)ret_conv;
22663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22664 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
22665 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
22669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22670 if ((_res & 1) != 0) return;
22671 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22672 CHECK_ACCESS(_res_ptr);
22673 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
22675 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
22678 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
22679 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22680 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
22681 return (int64_t)ret_conv;
22683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22684 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
22685 int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
22689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22690 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
22691 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
22692 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
22693 return (int64_t)ret_conv;
22696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22697 LDKFundingSigned o_conv;
22698 o_conv.inner = (void*)(o & (~1));
22699 o_conv.is_owned = (o & 1) || (o == 0);
22700 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22701 o_conv = FundingSigned_clone(&o_conv);
22702 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22703 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
22704 return (int64_t)ret_conv;
22707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22708 LDKDecodeError e_conv;
22709 e_conv.inner = (void*)(e & (~1));
22710 e_conv.is_owned = (e & 1) || (e == 0);
22711 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22712 e_conv = DecodeError_clone(&e_conv);
22713 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22714 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
22715 return (int64_t)ret_conv;
22718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22719 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
22720 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
22724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22725 if ((_res & 1) != 0) return;
22726 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22727 CHECK_ACCESS(_res_ptr);
22728 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
22730 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
22733 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
22734 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22735 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
22736 return (int64_t)ret_conv;
22738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22739 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
22740 int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
22744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22745 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
22746 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
22747 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
22748 return (int64_t)ret_conv;
22751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22752 LDKChannelReady o_conv;
22753 o_conv.inner = (void*)(o & (~1));
22754 o_conv.is_owned = (o & 1) || (o == 0);
22755 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22756 o_conv = ChannelReady_clone(&o_conv);
22757 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22758 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
22759 return (int64_t)ret_conv;
22762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22763 LDKDecodeError e_conv;
22764 e_conv.inner = (void*)(e & (~1));
22765 e_conv.is_owned = (e & 1) || (e == 0);
22766 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22767 e_conv = DecodeError_clone(&e_conv);
22768 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22769 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
22770 return (int64_t)ret_conv;
22773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22774 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
22775 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
22779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22780 if ((_res & 1) != 0) return;
22781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22782 CHECK_ACCESS(_res_ptr);
22783 LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
22785 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
22788 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
22789 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22790 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
22791 return (int64_t)ret_conv;
22793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22794 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
22795 int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
22799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22800 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
22801 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
22802 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
22803 return (int64_t)ret_conv;
22806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22808 o_conv.inner = (void*)(o & (~1));
22809 o_conv.is_owned = (o & 1) || (o == 0);
22810 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22811 o_conv = Init_clone(&o_conv);
22812 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22813 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
22814 return (int64_t)ret_conv;
22817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22818 LDKDecodeError e_conv;
22819 e_conv.inner = (void*)(e & (~1));
22820 e_conv.is_owned = (e & 1) || (e == 0);
22821 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22822 e_conv = DecodeError_clone(&e_conv);
22823 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22824 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
22825 return (int64_t)ret_conv;
22828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22829 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
22830 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
22834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22835 if ((_res & 1) != 0) return;
22836 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22837 CHECK_ACCESS(_res_ptr);
22838 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
22840 CResult_InitDecodeErrorZ_free(_res_conv);
22843 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
22844 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22845 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
22846 return (int64_t)ret_conv;
22848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22849 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
22850 int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
22854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22855 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
22856 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
22857 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
22858 return (int64_t)ret_conv;
22861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22862 LDKOpenChannel o_conv;
22863 o_conv.inner = (void*)(o & (~1));
22864 o_conv.is_owned = (o & 1) || (o == 0);
22865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22866 o_conv = OpenChannel_clone(&o_conv);
22867 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22868 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
22869 return (int64_t)ret_conv;
22872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22873 LDKDecodeError e_conv;
22874 e_conv.inner = (void*)(e & (~1));
22875 e_conv.is_owned = (e & 1) || (e == 0);
22876 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22877 e_conv = DecodeError_clone(&e_conv);
22878 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22879 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
22880 return (int64_t)ret_conv;
22883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22884 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
22885 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
22889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22890 if ((_res & 1) != 0) return;
22891 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22892 CHECK_ACCESS(_res_ptr);
22893 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
22895 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
22898 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
22899 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22900 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
22901 return (int64_t)ret_conv;
22903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22904 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
22905 int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
22909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22910 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
22911 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
22912 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
22913 return (int64_t)ret_conv;
22916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22917 LDKRevokeAndACK o_conv;
22918 o_conv.inner = (void*)(o & (~1));
22919 o_conv.is_owned = (o & 1) || (o == 0);
22920 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22921 o_conv = RevokeAndACK_clone(&o_conv);
22922 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22923 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
22924 return (int64_t)ret_conv;
22927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22928 LDKDecodeError e_conv;
22929 e_conv.inner = (void*)(e & (~1));
22930 e_conv.is_owned = (e & 1) || (e == 0);
22931 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22932 e_conv = DecodeError_clone(&e_conv);
22933 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22934 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
22935 return (int64_t)ret_conv;
22938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22939 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
22940 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
22944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22945 if ((_res & 1) != 0) return;
22946 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22947 CHECK_ACCESS(_res_ptr);
22948 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
22950 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
22953 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
22954 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22955 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
22956 return (int64_t)ret_conv;
22958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22959 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
22960 int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
22964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22965 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
22966 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
22967 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
22968 return (int64_t)ret_conv;
22971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22972 LDKShutdown o_conv;
22973 o_conv.inner = (void*)(o & (~1));
22974 o_conv.is_owned = (o & 1) || (o == 0);
22975 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22976 o_conv = Shutdown_clone(&o_conv);
22977 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22978 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
22979 return (int64_t)ret_conv;
22982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22983 LDKDecodeError e_conv;
22984 e_conv.inner = (void*)(e & (~1));
22985 e_conv.is_owned = (e & 1) || (e == 0);
22986 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22987 e_conv = DecodeError_clone(&e_conv);
22988 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
22989 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
22990 return (int64_t)ret_conv;
22993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22994 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
22995 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
22999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23000 if ((_res & 1) != 0) return;
23001 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23002 CHECK_ACCESS(_res_ptr);
23003 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
23005 CResult_ShutdownDecodeErrorZ_free(_res_conv);
23008 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
23009 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23010 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
23011 return (int64_t)ret_conv;
23013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23014 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
23015 int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
23019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23020 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
23021 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23022 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
23023 return (int64_t)ret_conv;
23026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23027 LDKUpdateFailHTLC o_conv;
23028 o_conv.inner = (void*)(o & (~1));
23029 o_conv.is_owned = (o & 1) || (o == 0);
23030 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23031 o_conv = UpdateFailHTLC_clone(&o_conv);
23032 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23033 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
23034 return (int64_t)ret_conv;
23037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23038 LDKDecodeError e_conv;
23039 e_conv.inner = (void*)(e & (~1));
23040 e_conv.is_owned = (e & 1) || (e == 0);
23041 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23042 e_conv = DecodeError_clone(&e_conv);
23043 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23044 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
23045 return (int64_t)ret_conv;
23048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23049 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
23050 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
23054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23055 if ((_res & 1) != 0) return;
23056 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23057 CHECK_ACCESS(_res_ptr);
23058 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
23060 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
23063 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
23064 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23065 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
23066 return (int64_t)ret_conv;
23068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23069 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
23070 int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
23074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23075 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
23076 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23077 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
23078 return (int64_t)ret_conv;
23081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23082 LDKUpdateFailMalformedHTLC o_conv;
23083 o_conv.inner = (void*)(o & (~1));
23084 o_conv.is_owned = (o & 1) || (o == 0);
23085 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23086 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
23087 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23088 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
23089 return (int64_t)ret_conv;
23092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23093 LDKDecodeError e_conv;
23094 e_conv.inner = (void*)(e & (~1));
23095 e_conv.is_owned = (e & 1) || (e == 0);
23096 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23097 e_conv = DecodeError_clone(&e_conv);
23098 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23099 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
23100 return (int64_t)ret_conv;
23103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23104 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
23105 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
23109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23110 if ((_res & 1) != 0) return;
23111 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23112 CHECK_ACCESS(_res_ptr);
23113 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
23115 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
23118 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
23119 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23120 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
23121 return (int64_t)ret_conv;
23123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23124 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
23125 int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
23129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23130 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
23131 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23132 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
23133 return (int64_t)ret_conv;
23136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23137 LDKUpdateFee o_conv;
23138 o_conv.inner = (void*)(o & (~1));
23139 o_conv.is_owned = (o & 1) || (o == 0);
23140 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23141 o_conv = UpdateFee_clone(&o_conv);
23142 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23143 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
23144 return (int64_t)ret_conv;
23147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23148 LDKDecodeError e_conv;
23149 e_conv.inner = (void*)(e & (~1));
23150 e_conv.is_owned = (e & 1) || (e == 0);
23151 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23152 e_conv = DecodeError_clone(&e_conv);
23153 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23154 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
23155 return (int64_t)ret_conv;
23158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23159 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
23160 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
23164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23165 if ((_res & 1) != 0) return;
23166 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23167 CHECK_ACCESS(_res_ptr);
23168 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
23170 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
23173 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
23174 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23175 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
23176 return (int64_t)ret_conv;
23178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23179 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
23180 int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
23184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23185 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
23186 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23187 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
23188 return (int64_t)ret_conv;
23191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23192 LDKUpdateFulfillHTLC o_conv;
23193 o_conv.inner = (void*)(o & (~1));
23194 o_conv.is_owned = (o & 1) || (o == 0);
23195 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23196 o_conv = UpdateFulfillHTLC_clone(&o_conv);
23197 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23198 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
23199 return (int64_t)ret_conv;
23202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23203 LDKDecodeError e_conv;
23204 e_conv.inner = (void*)(e & (~1));
23205 e_conv.is_owned = (e & 1) || (e == 0);
23206 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23207 e_conv = DecodeError_clone(&e_conv);
23208 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23209 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
23210 return (int64_t)ret_conv;
23213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23214 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
23215 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
23219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23220 if ((_res & 1) != 0) return;
23221 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23222 CHECK_ACCESS(_res_ptr);
23223 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
23225 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
23228 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
23229 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23230 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
23231 return (int64_t)ret_conv;
23233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23234 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
23235 int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
23239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23240 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
23241 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23242 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
23243 return (int64_t)ret_conv;
23246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23247 LDKUpdateAddHTLC o_conv;
23248 o_conv.inner = (void*)(o & (~1));
23249 o_conv.is_owned = (o & 1) || (o == 0);
23250 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23251 o_conv = UpdateAddHTLC_clone(&o_conv);
23252 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23253 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
23254 return (int64_t)ret_conv;
23257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23258 LDKDecodeError e_conv;
23259 e_conv.inner = (void*)(e & (~1));
23260 e_conv.is_owned = (e & 1) || (e == 0);
23261 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23262 e_conv = DecodeError_clone(&e_conv);
23263 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23264 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
23265 return (int64_t)ret_conv;
23268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23269 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
23270 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
23274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23275 if ((_res & 1) != 0) return;
23276 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23277 CHECK_ACCESS(_res_ptr);
23278 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
23280 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
23283 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
23284 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23285 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
23286 return (int64_t)ret_conv;
23288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23289 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
23290 int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
23294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23295 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
23296 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23297 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
23298 return (int64_t)ret_conv;
23301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23303 o_conv.inner = (void*)(o & (~1));
23304 o_conv.is_owned = (o & 1) || (o == 0);
23305 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23306 o_conv = Ping_clone(&o_conv);
23307 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23308 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
23309 return (int64_t)ret_conv;
23312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23313 LDKDecodeError e_conv;
23314 e_conv.inner = (void*)(e & (~1));
23315 e_conv.is_owned = (e & 1) || (e == 0);
23316 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23317 e_conv = DecodeError_clone(&e_conv);
23318 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23319 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
23320 return (int64_t)ret_conv;
23323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23324 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
23325 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
23329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23330 if ((_res & 1) != 0) return;
23331 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23332 CHECK_ACCESS(_res_ptr);
23333 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
23335 CResult_PingDecodeErrorZ_free(_res_conv);
23338 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
23339 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23340 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
23341 return (int64_t)ret_conv;
23343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23344 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
23345 int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
23349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23350 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
23351 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23352 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
23353 return (int64_t)ret_conv;
23356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23358 o_conv.inner = (void*)(o & (~1));
23359 o_conv.is_owned = (o & 1) || (o == 0);
23360 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23361 o_conv = Pong_clone(&o_conv);
23362 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23363 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
23364 return (int64_t)ret_conv;
23367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23368 LDKDecodeError e_conv;
23369 e_conv.inner = (void*)(e & (~1));
23370 e_conv.is_owned = (e & 1) || (e == 0);
23371 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23372 e_conv = DecodeError_clone(&e_conv);
23373 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23374 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
23375 return (int64_t)ret_conv;
23378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23379 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
23380 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
23384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23385 if ((_res & 1) != 0) return;
23386 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23387 CHECK_ACCESS(_res_ptr);
23388 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
23390 CResult_PongDecodeErrorZ_free(_res_conv);
23393 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
23394 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23395 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
23396 return (int64_t)ret_conv;
23398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23399 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
23400 int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
23404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23405 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
23406 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23407 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
23408 return (int64_t)ret_conv;
23411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23412 LDKUnsignedChannelAnnouncement o_conv;
23413 o_conv.inner = (void*)(o & (~1));
23414 o_conv.is_owned = (o & 1) || (o == 0);
23415 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23416 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
23417 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23418 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
23419 return (int64_t)ret_conv;
23422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23423 LDKDecodeError e_conv;
23424 e_conv.inner = (void*)(e & (~1));
23425 e_conv.is_owned = (e & 1) || (e == 0);
23426 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23427 e_conv = DecodeError_clone(&e_conv);
23428 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23429 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
23430 return (int64_t)ret_conv;
23433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23434 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
23435 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
23439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23440 if ((_res & 1) != 0) return;
23441 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23442 CHECK_ACCESS(_res_ptr);
23443 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
23445 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
23448 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23449 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23450 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
23451 return (int64_t)ret_conv;
23453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23454 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
23455 int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23460 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
23461 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23462 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
23463 return (int64_t)ret_conv;
23466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23467 LDKChannelAnnouncement o_conv;
23468 o_conv.inner = (void*)(o & (~1));
23469 o_conv.is_owned = (o & 1) || (o == 0);
23470 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23471 o_conv = ChannelAnnouncement_clone(&o_conv);
23472 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23473 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
23474 return (int64_t)ret_conv;
23477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23478 LDKDecodeError e_conv;
23479 e_conv.inner = (void*)(e & (~1));
23480 e_conv.is_owned = (e & 1) || (e == 0);
23481 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23482 e_conv = DecodeError_clone(&e_conv);
23483 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23484 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
23485 return (int64_t)ret_conv;
23488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23489 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
23490 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
23494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23495 if ((_res & 1) != 0) return;
23496 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23497 CHECK_ACCESS(_res_ptr);
23498 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
23500 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
23503 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23504 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23505 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
23506 return (int64_t)ret_conv;
23508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23509 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
23510 int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23515 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
23516 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23517 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
23518 return (int64_t)ret_conv;
23521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23522 LDKUnsignedChannelUpdate o_conv;
23523 o_conv.inner = (void*)(o & (~1));
23524 o_conv.is_owned = (o & 1) || (o == 0);
23525 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23526 o_conv = UnsignedChannelUpdate_clone(&o_conv);
23527 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23528 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
23529 return (int64_t)ret_conv;
23532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23533 LDKDecodeError e_conv;
23534 e_conv.inner = (void*)(e & (~1));
23535 e_conv.is_owned = (e & 1) || (e == 0);
23536 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23537 e_conv = DecodeError_clone(&e_conv);
23538 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23539 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
23540 return (int64_t)ret_conv;
23543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23544 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
23545 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
23549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23550 if ((_res & 1) != 0) return;
23551 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23552 CHECK_ACCESS(_res_ptr);
23553 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
23555 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
23558 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
23559 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23560 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
23561 return (int64_t)ret_conv;
23563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23564 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
23565 int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
23569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23570 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
23571 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23572 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
23573 return (int64_t)ret_conv;
23576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23577 LDKChannelUpdate o_conv;
23578 o_conv.inner = (void*)(o & (~1));
23579 o_conv.is_owned = (o & 1) || (o == 0);
23580 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23581 o_conv = ChannelUpdate_clone(&o_conv);
23582 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23583 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
23584 return (int64_t)ret_conv;
23587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23588 LDKDecodeError e_conv;
23589 e_conv.inner = (void*)(e & (~1));
23590 e_conv.is_owned = (e & 1) || (e == 0);
23591 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23592 e_conv = DecodeError_clone(&e_conv);
23593 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23594 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
23595 return (int64_t)ret_conv;
23598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23599 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
23600 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
23604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23605 if ((_res & 1) != 0) return;
23606 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23607 CHECK_ACCESS(_res_ptr);
23608 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
23610 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
23613 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
23614 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23615 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
23616 return (int64_t)ret_conv;
23618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23619 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
23620 int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
23624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23625 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
23626 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23627 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
23628 return (int64_t)ret_conv;
23631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23632 LDKErrorMessage o_conv;
23633 o_conv.inner = (void*)(o & (~1));
23634 o_conv.is_owned = (o & 1) || (o == 0);
23635 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23636 o_conv = ErrorMessage_clone(&o_conv);
23637 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23638 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
23639 return (int64_t)ret_conv;
23642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23643 LDKDecodeError e_conv;
23644 e_conv.inner = (void*)(e & (~1));
23645 e_conv.is_owned = (e & 1) || (e == 0);
23646 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23647 e_conv = DecodeError_clone(&e_conv);
23648 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23649 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
23650 return (int64_t)ret_conv;
23653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23654 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
23655 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
23659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23660 if ((_res & 1) != 0) return;
23661 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23662 CHECK_ACCESS(_res_ptr);
23663 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
23665 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
23668 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
23669 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23670 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
23671 return (int64_t)ret_conv;
23673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23674 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
23675 int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
23679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23680 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
23681 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23682 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
23683 return (int64_t)ret_conv;
23686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23687 LDKWarningMessage o_conv;
23688 o_conv.inner = (void*)(o & (~1));
23689 o_conv.is_owned = (o & 1) || (o == 0);
23690 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23691 o_conv = WarningMessage_clone(&o_conv);
23692 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23693 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
23694 return (int64_t)ret_conv;
23697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23698 LDKDecodeError e_conv;
23699 e_conv.inner = (void*)(e & (~1));
23700 e_conv.is_owned = (e & 1) || (e == 0);
23701 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23702 e_conv = DecodeError_clone(&e_conv);
23703 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23704 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
23705 return (int64_t)ret_conv;
23708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23709 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
23710 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
23714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23715 if ((_res & 1) != 0) return;
23716 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23717 CHECK_ACCESS(_res_ptr);
23718 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
23720 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
23723 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
23724 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23725 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
23726 return (int64_t)ret_conv;
23728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23729 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
23730 int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
23734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23735 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
23736 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
23737 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
23738 return (int64_t)ret_conv;
23741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23742 LDKUnsignedNodeAnnouncement o_conv;
23743 o_conv.inner = (void*)(o & (~1));
23744 o_conv.is_owned = (o & 1) || (o == 0);
23745 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23746 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
23747 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23748 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
23749 return (int64_t)ret_conv;
23752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23753 LDKDecodeError e_conv;
23754 e_conv.inner = (void*)(e & (~1));
23755 e_conv.is_owned = (e & 1) || (e == 0);
23756 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23757 e_conv = DecodeError_clone(&e_conv);
23758 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23759 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
23760 return (int64_t)ret_conv;
23763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23764 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
23765 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23770 if ((_res & 1) != 0) return;
23771 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23772 CHECK_ACCESS(_res_ptr);
23773 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
23775 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
23778 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23779 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23780 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
23781 return (int64_t)ret_conv;
23783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23784 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
23785 int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23790 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
23791 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23792 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
23793 return (int64_t)ret_conv;
23796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23797 LDKNodeAnnouncement o_conv;
23798 o_conv.inner = (void*)(o & (~1));
23799 o_conv.is_owned = (o & 1) || (o == 0);
23800 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23801 o_conv = NodeAnnouncement_clone(&o_conv);
23802 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23803 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
23804 return (int64_t)ret_conv;
23807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23808 LDKDecodeError e_conv;
23809 e_conv.inner = (void*)(e & (~1));
23810 e_conv.is_owned = (e & 1) || (e == 0);
23811 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23812 e_conv = DecodeError_clone(&e_conv);
23813 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23814 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
23815 return (int64_t)ret_conv;
23818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23819 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
23820 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
23824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23825 if ((_res & 1) != 0) return;
23826 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23827 CHECK_ACCESS(_res_ptr);
23828 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
23830 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
23833 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23834 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23835 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
23836 return (int64_t)ret_conv;
23838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23839 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
23840 int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23845 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
23846 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23847 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
23848 return (int64_t)ret_conv;
23851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23852 LDKQueryShortChannelIds o_conv;
23853 o_conv.inner = (void*)(o & (~1));
23854 o_conv.is_owned = (o & 1) || (o == 0);
23855 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23856 o_conv = QueryShortChannelIds_clone(&o_conv);
23857 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23858 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
23859 return (int64_t)ret_conv;
23862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23863 LDKDecodeError e_conv;
23864 e_conv.inner = (void*)(e & (~1));
23865 e_conv.is_owned = (e & 1) || (e == 0);
23866 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23867 e_conv = DecodeError_clone(&e_conv);
23868 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23869 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
23870 return (int64_t)ret_conv;
23873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23874 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
23875 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
23879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23880 if ((_res & 1) != 0) return;
23881 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23882 CHECK_ACCESS(_res_ptr);
23883 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
23885 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
23888 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
23889 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23890 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
23891 return (int64_t)ret_conv;
23893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23894 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
23895 int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
23899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23900 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
23901 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23902 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
23903 return (int64_t)ret_conv;
23906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23907 LDKReplyShortChannelIdsEnd o_conv;
23908 o_conv.inner = (void*)(o & (~1));
23909 o_conv.is_owned = (o & 1) || (o == 0);
23910 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23911 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
23912 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23913 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
23914 return (int64_t)ret_conv;
23917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23918 LDKDecodeError e_conv;
23919 e_conv.inner = (void*)(e & (~1));
23920 e_conv.is_owned = (e & 1) || (e == 0);
23921 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23922 e_conv = DecodeError_clone(&e_conv);
23923 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23924 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
23925 return (int64_t)ret_conv;
23928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23929 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
23930 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
23934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23935 if ((_res & 1) != 0) return;
23936 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23937 CHECK_ACCESS(_res_ptr);
23938 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
23940 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
23943 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
23944 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23945 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
23946 return (int64_t)ret_conv;
23948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23949 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
23950 int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
23954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23955 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
23956 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23957 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
23958 return (int64_t)ret_conv;
23961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23962 LDKQueryChannelRange o_conv;
23963 o_conv.inner = (void*)(o & (~1));
23964 o_conv.is_owned = (o & 1) || (o == 0);
23965 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23966 o_conv = QueryChannelRange_clone(&o_conv);
23967 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23968 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
23969 return (int64_t)ret_conv;
23972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23973 LDKDecodeError e_conv;
23974 e_conv.inner = (void*)(e & (~1));
23975 e_conv.is_owned = (e & 1) || (e == 0);
23976 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23977 e_conv = DecodeError_clone(&e_conv);
23978 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23979 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
23980 return (int64_t)ret_conv;
23983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23984 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
23985 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
23989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23990 if ((_res & 1) != 0) return;
23991 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23992 CHECK_ACCESS(_res_ptr);
23993 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
23995 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
23998 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
23999 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24000 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
24001 return (int64_t)ret_conv;
24003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24004 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
24005 int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
24009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24010 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
24011 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24012 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
24013 return (int64_t)ret_conv;
24016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24017 LDKReplyChannelRange o_conv;
24018 o_conv.inner = (void*)(o & (~1));
24019 o_conv.is_owned = (o & 1) || (o == 0);
24020 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24021 o_conv = ReplyChannelRange_clone(&o_conv);
24022 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24023 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
24024 return (int64_t)ret_conv;
24027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24028 LDKDecodeError e_conv;
24029 e_conv.inner = (void*)(e & (~1));
24030 e_conv.is_owned = (e & 1) || (e == 0);
24031 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24032 e_conv = DecodeError_clone(&e_conv);
24033 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24034 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
24035 return (int64_t)ret_conv;
24038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24039 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
24040 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
24044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24045 if ((_res & 1) != 0) return;
24046 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24047 CHECK_ACCESS(_res_ptr);
24048 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
24050 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
24053 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
24054 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24055 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
24056 return (int64_t)ret_conv;
24058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24059 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
24060 int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
24064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24065 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
24066 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24067 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
24068 return (int64_t)ret_conv;
24071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24072 LDKGossipTimestampFilter o_conv;
24073 o_conv.inner = (void*)(o & (~1));
24074 o_conv.is_owned = (o & 1) || (o == 0);
24075 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24076 o_conv = GossipTimestampFilter_clone(&o_conv);
24077 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24078 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
24079 return (int64_t)ret_conv;
24082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24083 LDKDecodeError e_conv;
24084 e_conv.inner = (void*)(e & (~1));
24085 e_conv.is_owned = (e & 1) || (e == 0);
24086 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24087 e_conv = DecodeError_clone(&e_conv);
24088 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24089 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
24090 return (int64_t)ret_conv;
24093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24094 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
24095 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
24099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24100 if ((_res & 1) != 0) return;
24101 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24102 CHECK_ACCESS(_res_ptr);
24103 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
24105 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
24108 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
24109 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24110 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
24111 return (int64_t)ret_conv;
24113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24114 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
24115 int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
24119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24120 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
24121 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24122 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
24123 return (int64_t)ret_conv;
24126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24127 LDKCVec_PhantomRouteHintsZ _res_constr;
24128 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24129 if (_res_constr.datalen > 0)
24130 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
24132 _res_constr.data = NULL;
24133 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24134 for (size_t t = 0; t < _res_constr.datalen; t++) {
24135 int64_t _res_conv_19 = _res_vals[t];
24136 LDKPhantomRouteHints _res_conv_19_conv;
24137 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
24138 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
24139 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
24140 _res_constr.data[t] = _res_conv_19_conv;
24142 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24143 CVec_PhantomRouteHintsZ_free(_res_constr);
24146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24148 o_conv.inner = (void*)(o & (~1));
24149 o_conv.is_owned = (o & 1) || (o == 0);
24150 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24151 o_conv = Invoice_clone(&o_conv);
24152 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24153 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
24154 return (int64_t)ret_conv;
24157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24158 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
24159 CHECK_ACCESS(e_ptr);
24160 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
24161 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
24162 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24163 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
24164 return (int64_t)ret_conv;
24167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24168 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
24169 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
24173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24174 if ((_res & 1) != 0) return;
24175 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24176 CHECK_ACCESS(_res_ptr);
24177 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
24179 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
24182 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
24183 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24184 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
24185 return (int64_t)ret_conv;
24187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24188 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
24189 int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
24193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24194 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
24195 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24196 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
24197 return (int64_t)ret_conv;
24200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24201 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
24202 CHECK_ACCESS(o_ptr);
24203 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
24204 if (o_conv.free == LDKFilter_JCalls_free) {
24205 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24206 LDKFilter_JCalls_cloned(&o_conv);
24208 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
24209 *ret_copy = COption_FilterZ_some(o_conv);
24210 int64_t ret_ref = (uintptr_t)ret_copy;
24214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
24215 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
24216 *ret_copy = COption_FilterZ_none();
24217 int64_t ret_ref = (uintptr_t)ret_copy;
24221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24222 if ((_res & 1) != 0) return;
24223 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24224 CHECK_ACCESS(_res_ptr);
24225 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
24227 COption_FilterZ_free(_res_conv);
24230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24231 LDKLockedChannelMonitor o_conv;
24232 o_conv.inner = (void*)(o & (~1));
24233 o_conv.is_owned = (o & 1) || (o == 0);
24234 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24235 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
24236 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24237 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
24238 return (int64_t)ret_conv;
24241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
24242 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24243 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
24244 return (int64_t)ret_conv;
24247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24248 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
24249 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
24253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24254 if ((_res & 1) != 0) return;
24255 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
24256 CHECK_ACCESS(_res_ptr);
24257 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
24259 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
24262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24263 LDKCVec_OutPointZ _res_constr;
24264 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24265 if (_res_constr.datalen > 0)
24266 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
24268 _res_constr.data = NULL;
24269 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24270 for (size_t k = 0; k < _res_constr.datalen; k++) {
24271 int64_t _res_conv_10 = _res_vals[k];
24272 LDKOutPoint _res_conv_10_conv;
24273 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
24274 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
24275 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
24276 _res_constr.data[k] = _res_conv_10_conv;
24278 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24279 CVec_OutPointZ_free(_res_constr);
24282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24283 if ((this_ptr & 1) != 0) return;
24284 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24285 CHECK_ACCESS(this_ptr_ptr);
24286 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
24287 FREE((void*)this_ptr);
24288 PaymentPurpose_free(this_ptr_conv);
24291 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
24292 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24293 *ret_copy = PaymentPurpose_clone(arg);
24294 int64_t ret_ref = (uintptr_t)ret_copy;
24297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24298 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
24299 int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
24303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24304 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
24305 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24306 *ret_copy = PaymentPurpose_clone(orig_conv);
24307 int64_t ret_ref = (uintptr_t)ret_copy;
24311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
24312 LDKThirtyTwoBytes payment_preimage_ref;
24313 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
24314 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
24315 LDKThirtyTwoBytes payment_secret_ref;
24316 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
24317 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
24318 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24319 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
24320 int64_t ret_ref = (uintptr_t)ret_copy;
24324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
24325 LDKThirtyTwoBytes a_ref;
24326 CHECK((*env)->GetArrayLength(env, a) == 32);
24327 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
24328 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24329 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
24330 int64_t ret_ref = (uintptr_t)ret_copy;
24334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
24335 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
24336 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
24337 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24338 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24339 CVec_u8Z_free(ret_var);
24343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24344 LDKu8slice ser_ref;
24345 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24346 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24347 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
24348 *ret_conv = PaymentPurpose_read(ser_ref);
24349 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24350 return (int64_t)ret_conv;
24353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24354 if ((this_ptr & 1) != 0) return;
24355 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24356 CHECK_ACCESS(this_ptr_ptr);
24357 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
24358 FREE((void*)this_ptr);
24359 ClosureReason_free(this_ptr_conv);
24362 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
24363 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24364 *ret_copy = ClosureReason_clone(arg);
24365 int64_t ret_ref = (uintptr_t)ret_copy;
24368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24369 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
24370 int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
24374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24375 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
24376 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24377 *ret_copy = ClosureReason_clone(orig_conv);
24378 int64_t ret_ref = (uintptr_t)ret_copy;
24382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
24383 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
24384 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24385 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
24386 int64_t ret_ref = (uintptr_t)ret_copy;
24390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
24391 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24392 *ret_copy = ClosureReason_holder_force_closed();
24393 int64_t ret_ref = (uintptr_t)ret_copy;
24397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
24398 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24399 *ret_copy = ClosureReason_cooperative_closure();
24400 int64_t ret_ref = (uintptr_t)ret_copy;
24404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
24405 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24406 *ret_copy = ClosureReason_commitment_tx_confirmed();
24407 int64_t ret_ref = (uintptr_t)ret_copy;
24411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
24412 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24413 *ret_copy = ClosureReason_funding_timed_out();
24414 int64_t ret_ref = (uintptr_t)ret_copy;
24418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
24419 LDKStr err_conv = java_to_owned_str(env, err);
24420 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24421 *ret_copy = ClosureReason_processing_error(err_conv);
24422 int64_t ret_ref = (uintptr_t)ret_copy;
24426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
24427 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24428 *ret_copy = ClosureReason_disconnected_peer();
24429 int64_t ret_ref = (uintptr_t)ret_copy;
24433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
24434 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24435 *ret_copy = ClosureReason_outdated_channel_manager();
24436 int64_t ret_ref = (uintptr_t)ret_copy;
24440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
24441 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
24442 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
24443 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24444 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24445 CVec_u8Z_free(ret_var);
24449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24450 LDKu8slice ser_ref;
24451 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24452 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24453 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
24454 *ret_conv = ClosureReason_read(ser_ref);
24455 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24456 return (int64_t)ret_conv;
24459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24460 if ((this_ptr & 1) != 0) return;
24461 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24462 CHECK_ACCESS(this_ptr_ptr);
24463 LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
24464 FREE((void*)this_ptr);
24465 HTLCDestination_free(this_ptr_conv);
24468 static inline uintptr_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
24469 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24470 *ret_copy = HTLCDestination_clone(arg);
24471 int64_t ret_ref = (uintptr_t)ret_copy;
24474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24475 LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)arg;
24476 int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
24480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24481 LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)orig;
24482 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24483 *ret_copy = HTLCDestination_clone(orig_conv);
24484 int64_t ret_ref = (uintptr_t)ret_copy;
24488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) {
24489 LDKPublicKey node_id_ref;
24490 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24491 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24492 LDKThirtyTwoBytes channel_id_ref;
24493 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24494 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24495 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24496 *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
24497 int64_t ret_ref = (uintptr_t)ret_copy;
24501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
24502 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24503 *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
24504 int64_t ret_ref = (uintptr_t)ret_copy;
24508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
24509 LDKThirtyTwoBytes payment_hash_ref;
24510 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24511 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24512 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
24513 *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
24514 int64_t ret_ref = (uintptr_t)ret_copy;
24518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
24519 LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)obj;
24520 LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
24521 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24522 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24523 CVec_u8Z_free(ret_var);
24527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24528 LDKu8slice ser_ref;
24529 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24530 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24531 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
24532 *ret_conv = HTLCDestination_read(ser_ref);
24533 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24534 return (int64_t)ret_conv;
24537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24538 if ((this_ptr & 1) != 0) return;
24539 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24540 CHECK_ACCESS(this_ptr_ptr);
24541 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
24542 FREE((void*)this_ptr);
24543 Event_free(this_ptr_conv);
24546 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
24547 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24548 *ret_copy = Event_clone(arg);
24549 int64_t ret_ref = (uintptr_t)ret_copy;
24552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24553 LDKEvent* arg_conv = (LDKEvent*)arg;
24554 int64_t ret_conv = Event_clone_ptr(arg_conv);
24558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24559 LDKEvent* orig_conv = (LDKEvent*)orig;
24560 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24561 *ret_copy = Event_clone(orig_conv);
24562 int64_t ret_ref = (uintptr_t)ret_copy;
24566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
24567 LDKThirtyTwoBytes temporary_channel_id_ref;
24568 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
24569 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
24570 LDKPublicKey counterparty_node_id_ref;
24571 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
24572 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
24573 LDKCVec_u8Z output_script_ref;
24574 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
24575 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
24576 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
24577 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24578 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
24579 int64_t ret_ref = (uintptr_t)ret_copy;
24583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose) {
24584 LDKThirtyTwoBytes payment_hash_ref;
24585 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24586 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24587 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
24588 CHECK_ACCESS(purpose_ptr);
24589 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
24590 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
24591 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24592 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
24593 int64_t ret_ref = (uintptr_t)ret_copy;
24597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimed(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose) {
24598 LDKThirtyTwoBytes payment_hash_ref;
24599 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24600 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24601 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
24602 CHECK_ACCESS(purpose_ptr);
24603 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
24604 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
24605 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24606 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
24607 int64_t ret_ref = (uintptr_t)ret_copy;
24611 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) {
24612 LDKThirtyTwoBytes payment_id_ref;
24613 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24614 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24615 LDKThirtyTwoBytes payment_preimage_ref;
24616 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
24617 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
24618 LDKThirtyTwoBytes payment_hash_ref;
24619 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24620 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24621 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
24622 CHECK_ACCESS(fee_paid_msat_ptr);
24623 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
24624 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
24625 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24626 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
24627 int64_t ret_ref = (uintptr_t)ret_copy;
24631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
24632 LDKThirtyTwoBytes payment_id_ref;
24633 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24634 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24635 LDKThirtyTwoBytes payment_hash_ref;
24636 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24637 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24638 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24639 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
24640 int64_t ret_ref = (uintptr_t)ret_copy;
24644 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) {
24645 LDKThirtyTwoBytes payment_id_ref;
24646 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24647 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24648 LDKThirtyTwoBytes payment_hash_ref;
24649 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24650 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24651 LDKCVec_RouteHopZ path_constr;
24652 path_constr.datalen = (*env)->GetArrayLength(env, path);
24653 if (path_constr.datalen > 0)
24654 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24656 path_constr.data = NULL;
24657 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24658 for (size_t k = 0; k < path_constr.datalen; k++) {
24659 int64_t path_conv_10 = path_vals[k];
24660 LDKRouteHop path_conv_10_conv;
24661 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24662 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24663 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24664 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24665 path_constr.data[k] = path_conv_10_conv;
24667 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24668 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24669 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
24670 int64_t ret_ref = (uintptr_t)ret_copy;
24674 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) {
24675 LDKThirtyTwoBytes payment_id_ref;
24676 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24677 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24678 LDKThirtyTwoBytes payment_hash_ref;
24679 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24680 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24681 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
24682 CHECK_ACCESS(network_update_ptr);
24683 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
24684 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
24685 LDKCVec_RouteHopZ path_constr;
24686 path_constr.datalen = (*env)->GetArrayLength(env, path);
24687 if (path_constr.datalen > 0)
24688 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24690 path_constr.data = NULL;
24691 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24692 for (size_t k = 0; k < path_constr.datalen; k++) {
24693 int64_t path_conv_10 = path_vals[k];
24694 LDKRouteHop path_conv_10_conv;
24695 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24696 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24697 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24698 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24699 path_constr.data[k] = path_conv_10_conv;
24701 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24702 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
24703 CHECK_ACCESS(short_channel_id_ptr);
24704 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
24705 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
24706 LDKRouteParameters retry_conv;
24707 retry_conv.inner = (void*)(retry & (~1));
24708 retry_conv.is_owned = (retry & 1) || (retry == 0);
24709 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
24710 retry_conv = RouteParameters_clone(&retry_conv);
24711 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24712 *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);
24713 int64_t ret_ref = (uintptr_t)ret_copy;
24717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) {
24718 LDKThirtyTwoBytes payment_id_ref;
24719 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24720 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24721 LDKThirtyTwoBytes payment_hash_ref;
24722 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24723 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24724 LDKCVec_RouteHopZ path_constr;
24725 path_constr.datalen = (*env)->GetArrayLength(env, path);
24726 if (path_constr.datalen > 0)
24727 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24729 path_constr.data = NULL;
24730 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24731 for (size_t k = 0; k < path_constr.datalen; k++) {
24732 int64_t path_conv_10 = path_vals[k];
24733 LDKRouteHop path_conv_10_conv;
24734 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24735 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24736 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24737 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24738 path_constr.data[k] = path_conv_10_conv;
24740 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24741 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24742 *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
24743 int64_t ret_ref = (uintptr_t)ret_copy;
24747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path, int64_t short_channel_id) {
24748 LDKThirtyTwoBytes payment_id_ref;
24749 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
24750 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
24751 LDKThirtyTwoBytes payment_hash_ref;
24752 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
24753 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
24754 LDKCVec_RouteHopZ path_constr;
24755 path_constr.datalen = (*env)->GetArrayLength(env, path);
24756 if (path_constr.datalen > 0)
24757 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24759 path_constr.data = NULL;
24760 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
24761 for (size_t k = 0; k < path_constr.datalen; k++) {
24762 int64_t path_conv_10 = path_vals[k];
24763 LDKRouteHop path_conv_10_conv;
24764 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
24765 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
24766 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
24767 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
24768 path_constr.data[k] = path_conv_10_conv;
24770 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
24771 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
24772 CHECK_ACCESS(short_channel_id_ptr);
24773 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
24774 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
24775 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24776 *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
24777 int64_t ret_ref = (uintptr_t)ret_copy;
24781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
24782 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24783 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
24784 int64_t ret_ref = (uintptr_t)ret_copy;
24788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
24789 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
24790 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
24791 if (outputs_constr.datalen > 0)
24792 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24794 outputs_constr.data = NULL;
24795 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
24796 for (size_t b = 0; b < outputs_constr.datalen; b++) {
24797 int64_t outputs_conv_27 = outputs_vals[b];
24798 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
24799 CHECK_ACCESS(outputs_conv_27_ptr);
24800 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
24801 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
24802 outputs_constr.data[b] = outputs_conv_27_conv;
24804 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
24805 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24806 *ret_copy = Event_spendable_outputs(outputs_constr);
24807 int64_t ret_ref = (uintptr_t)ret_copy;
24811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int8_tArray next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
24812 LDKThirtyTwoBytes prev_channel_id_ref;
24813 CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
24814 (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
24815 LDKThirtyTwoBytes next_channel_id_ref;
24816 CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
24817 (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
24818 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
24819 CHECK_ACCESS(fee_earned_msat_ptr);
24820 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
24821 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
24822 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24823 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
24824 int64_t ret_ref = (uintptr_t)ret_copy;
24828 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) {
24829 LDKThirtyTwoBytes channel_id_ref;
24830 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24831 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24832 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
24833 CHECK_ACCESS(reason_ptr);
24834 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
24835 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
24836 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24837 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
24838 int64_t ret_ref = (uintptr_t)ret_copy;
24842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
24843 LDKThirtyTwoBytes channel_id_ref;
24844 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
24845 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
24846 LDKTransaction transaction_ref;
24847 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
24848 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
24849 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
24850 transaction_ref.data_is_owned = true;
24851 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24852 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
24853 int64_t ret_ref = (uintptr_t)ret_copy;
24857 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) {
24858 LDKThirtyTwoBytes temporary_channel_id_ref;
24859 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
24860 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
24861 LDKPublicKey counterparty_node_id_ref;
24862 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
24863 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
24864 LDKChannelTypeFeatures channel_type_conv;
24865 channel_type_conv.inner = (void*)(channel_type & (~1));
24866 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
24867 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
24868 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
24869 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24870 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
24871 int64_t ret_ref = (uintptr_t)ret_copy;
24875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) {
24876 LDKThirtyTwoBytes prev_channel_id_ref;
24877 CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
24878 (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
24879 void* failed_next_destination_ptr = (void*)(((uintptr_t)failed_next_destination) & ~1);
24880 CHECK_ACCESS(failed_next_destination_ptr);
24881 LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
24882 failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)failed_next_destination) & ~1));
24883 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24884 *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
24885 int64_t ret_ref = (uintptr_t)ret_copy;
24889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
24890 LDKEvent* obj_conv = (LDKEvent*)obj;
24891 LDKCVec_u8Z ret_var = Event_write(obj_conv);
24892 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24893 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24894 CVec_u8Z_free(ret_var);
24898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24899 LDKu8slice ser_ref;
24900 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24901 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24902 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
24903 *ret_conv = Event_read(ser_ref);
24904 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24905 return (int64_t)ret_conv;
24908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24909 if ((this_ptr & 1) != 0) return;
24910 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24911 CHECK_ACCESS(this_ptr_ptr);
24912 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
24913 FREE((void*)this_ptr);
24914 MessageSendEvent_free(this_ptr_conv);
24917 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
24918 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24919 *ret_copy = MessageSendEvent_clone(arg);
24920 int64_t ret_ref = (uintptr_t)ret_copy;
24923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24924 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
24925 int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
24929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24930 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
24931 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24932 *ret_copy = MessageSendEvent_clone(orig_conv);
24933 int64_t ret_ref = (uintptr_t)ret_copy;
24937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24938 LDKPublicKey node_id_ref;
24939 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24940 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24941 LDKAcceptChannel msg_conv;
24942 msg_conv.inner = (void*)(msg & (~1));
24943 msg_conv.is_owned = (msg & 1) || (msg == 0);
24944 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24945 msg_conv = AcceptChannel_clone(&msg_conv);
24946 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24947 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
24948 int64_t ret_ref = (uintptr_t)ret_copy;
24952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24953 LDKPublicKey node_id_ref;
24954 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24955 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24956 LDKOpenChannel msg_conv;
24957 msg_conv.inner = (void*)(msg & (~1));
24958 msg_conv.is_owned = (msg & 1) || (msg == 0);
24959 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24960 msg_conv = OpenChannel_clone(&msg_conv);
24961 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24962 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
24963 int64_t ret_ref = (uintptr_t)ret_copy;
24967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24968 LDKPublicKey node_id_ref;
24969 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24970 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24971 LDKFundingCreated msg_conv;
24972 msg_conv.inner = (void*)(msg & (~1));
24973 msg_conv.is_owned = (msg & 1) || (msg == 0);
24974 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24975 msg_conv = FundingCreated_clone(&msg_conv);
24976 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24977 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
24978 int64_t ret_ref = (uintptr_t)ret_copy;
24982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24983 LDKPublicKey node_id_ref;
24984 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24985 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24986 LDKFundingSigned msg_conv;
24987 msg_conv.inner = (void*)(msg & (~1));
24988 msg_conv.is_owned = (msg & 1) || (msg == 0);
24989 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24990 msg_conv = FundingSigned_clone(&msg_conv);
24991 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24992 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
24993 int64_t ret_ref = (uintptr_t)ret_copy;
24997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24998 LDKPublicKey node_id_ref;
24999 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25000 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25001 LDKChannelReady msg_conv;
25002 msg_conv.inner = (void*)(msg & (~1));
25003 msg_conv.is_owned = (msg & 1) || (msg == 0);
25004 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25005 msg_conv = ChannelReady_clone(&msg_conv);
25006 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25007 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
25008 int64_t ret_ref = (uintptr_t)ret_copy;
25012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25013 LDKPublicKey node_id_ref;
25014 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25015 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25016 LDKAnnouncementSignatures msg_conv;
25017 msg_conv.inner = (void*)(msg & (~1));
25018 msg_conv.is_owned = (msg & 1) || (msg == 0);
25019 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25020 msg_conv = AnnouncementSignatures_clone(&msg_conv);
25021 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25022 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
25023 int64_t ret_ref = (uintptr_t)ret_copy;
25027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
25028 LDKPublicKey node_id_ref;
25029 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25030 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25031 LDKCommitmentUpdate updates_conv;
25032 updates_conv.inner = (void*)(updates & (~1));
25033 updates_conv.is_owned = (updates & 1) || (updates == 0);
25034 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25035 updates_conv = CommitmentUpdate_clone(&updates_conv);
25036 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25037 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
25038 int64_t ret_ref = (uintptr_t)ret_copy;
25042 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) {
25043 LDKPublicKey node_id_ref;
25044 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25045 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25046 LDKRevokeAndACK msg_conv;
25047 msg_conv.inner = (void*)(msg & (~1));
25048 msg_conv.is_owned = (msg & 1) || (msg == 0);
25049 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25050 msg_conv = RevokeAndACK_clone(&msg_conv);
25051 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25052 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
25053 int64_t ret_ref = (uintptr_t)ret_copy;
25057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25058 LDKPublicKey node_id_ref;
25059 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25060 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25061 LDKClosingSigned msg_conv;
25062 msg_conv.inner = (void*)(msg & (~1));
25063 msg_conv.is_owned = (msg & 1) || (msg == 0);
25064 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25065 msg_conv = ClosingSigned_clone(&msg_conv);
25066 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25067 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
25068 int64_t ret_ref = (uintptr_t)ret_copy;
25072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25073 LDKPublicKey node_id_ref;
25074 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25075 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25076 LDKShutdown msg_conv;
25077 msg_conv.inner = (void*)(msg & (~1));
25078 msg_conv.is_owned = (msg & 1) || (msg == 0);
25079 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25080 msg_conv = Shutdown_clone(&msg_conv);
25081 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25082 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
25083 int64_t ret_ref = (uintptr_t)ret_copy;
25087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25088 LDKPublicKey node_id_ref;
25089 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25090 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25091 LDKChannelReestablish msg_conv;
25092 msg_conv.inner = (void*)(msg & (~1));
25093 msg_conv.is_owned = (msg & 1) || (msg == 0);
25094 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25095 msg_conv = ChannelReestablish_clone(&msg_conv);
25096 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25097 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
25098 int64_t ret_ref = (uintptr_t)ret_copy;
25102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
25103 LDKChannelAnnouncement msg_conv;
25104 msg_conv.inner = (void*)(msg & (~1));
25105 msg_conv.is_owned = (msg & 1) || (msg == 0);
25106 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25107 msg_conv = ChannelAnnouncement_clone(&msg_conv);
25108 LDKChannelUpdate update_msg_conv;
25109 update_msg_conv.inner = (void*)(update_msg & (~1));
25110 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
25111 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
25112 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
25113 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25114 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
25115 int64_t ret_ref = (uintptr_t)ret_copy;
25119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
25120 LDKNodeAnnouncement msg_conv;
25121 msg_conv.inner = (void*)(msg & (~1));
25122 msg_conv.is_owned = (msg & 1) || (msg == 0);
25123 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25124 msg_conv = NodeAnnouncement_clone(&msg_conv);
25125 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25126 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
25127 int64_t ret_ref = (uintptr_t)ret_copy;
25131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
25132 LDKChannelUpdate msg_conv;
25133 msg_conv.inner = (void*)(msg & (~1));
25134 msg_conv.is_owned = (msg & 1) || (msg == 0);
25135 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25136 msg_conv = ChannelUpdate_clone(&msg_conv);
25137 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25138 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
25139 int64_t ret_ref = (uintptr_t)ret_copy;
25143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25144 LDKPublicKey node_id_ref;
25145 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25146 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25147 LDKChannelUpdate msg_conv;
25148 msg_conv.inner = (void*)(msg & (~1));
25149 msg_conv.is_owned = (msg & 1) || (msg == 0);
25150 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25151 msg_conv = ChannelUpdate_clone(&msg_conv);
25152 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25153 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
25154 int64_t ret_ref = (uintptr_t)ret_copy;
25158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
25159 LDKPublicKey node_id_ref;
25160 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25161 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25162 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
25163 CHECK_ACCESS(action_ptr);
25164 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
25165 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
25166 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25167 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
25168 int64_t ret_ref = (uintptr_t)ret_copy;
25172 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) {
25173 LDKPublicKey node_id_ref;
25174 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25175 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25176 LDKQueryChannelRange msg_conv;
25177 msg_conv.inner = (void*)(msg & (~1));
25178 msg_conv.is_owned = (msg & 1) || (msg == 0);
25179 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25180 msg_conv = QueryChannelRange_clone(&msg_conv);
25181 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25182 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
25183 int64_t ret_ref = (uintptr_t)ret_copy;
25187 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) {
25188 LDKPublicKey node_id_ref;
25189 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25190 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25191 LDKQueryShortChannelIds msg_conv;
25192 msg_conv.inner = (void*)(msg & (~1));
25193 msg_conv.is_owned = (msg & 1) || (msg == 0);
25194 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25195 msg_conv = QueryShortChannelIds_clone(&msg_conv);
25196 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25197 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
25198 int64_t ret_ref = (uintptr_t)ret_copy;
25202 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) {
25203 LDKPublicKey node_id_ref;
25204 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25205 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25206 LDKReplyChannelRange msg_conv;
25207 msg_conv.inner = (void*)(msg & (~1));
25208 msg_conv.is_owned = (msg & 1) || (msg == 0);
25209 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25210 msg_conv = ReplyChannelRange_clone(&msg_conv);
25211 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25212 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
25213 int64_t ret_ref = (uintptr_t)ret_copy;
25217 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) {
25218 LDKPublicKey node_id_ref;
25219 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25220 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25221 LDKGossipTimestampFilter msg_conv;
25222 msg_conv.inner = (void*)(msg & (~1));
25223 msg_conv.is_owned = (msg & 1) || (msg == 0);
25224 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25225 msg_conv = GossipTimestampFilter_clone(&msg_conv);
25226 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25227 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
25228 int64_t ret_ref = (uintptr_t)ret_copy;
25232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25233 if ((this_ptr & 1) != 0) return;
25234 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25235 CHECK_ACCESS(this_ptr_ptr);
25236 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
25237 FREE((void*)this_ptr);
25238 MessageSendEventsProvider_free(this_ptr_conv);
25241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25242 if ((this_ptr & 1) != 0) return;
25243 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25244 CHECK_ACCESS(this_ptr_ptr);
25245 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
25246 FREE((void*)this_ptr);
25247 EventsProvider_free(this_ptr_conv);
25250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25251 if ((this_ptr & 1) != 0) return;
25252 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25253 CHECK_ACCESS(this_ptr_ptr);
25254 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
25255 FREE((void*)this_ptr);
25256 EventHandler_free(this_ptr_conv);
25259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25260 if ((this_ptr & 1) != 0) return;
25261 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25262 CHECK_ACCESS(this_ptr_ptr);
25263 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
25264 FREE((void*)this_ptr);
25265 APIError_free(this_ptr_conv);
25268 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
25269 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25270 *ret_copy = APIError_clone(arg);
25271 int64_t ret_ref = (uintptr_t)ret_copy;
25274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25275 LDKAPIError* arg_conv = (LDKAPIError*)arg;
25276 int64_t ret_conv = APIError_clone_ptr(arg_conv);
25280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25281 LDKAPIError* orig_conv = (LDKAPIError*)orig;
25282 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25283 *ret_copy = APIError_clone(orig_conv);
25284 int64_t ret_ref = (uintptr_t)ret_copy;
25288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
25289 LDKStr err_conv = java_to_owned_str(env, err);
25290 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25291 *ret_copy = APIError_apimisuse_error(err_conv);
25292 int64_t ret_ref = (uintptr_t)ret_copy;
25296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
25297 LDKStr err_conv = java_to_owned_str(env, err);
25298 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25299 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
25300 int64_t ret_ref = (uintptr_t)ret_copy;
25304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
25305 LDKStr err_conv = java_to_owned_str(env, err);
25306 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25307 *ret_copy = APIError_route_error(err_conv);
25308 int64_t ret_ref = (uintptr_t)ret_copy;
25312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
25313 LDKStr err_conv = java_to_owned_str(env, err);
25314 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25315 *ret_copy = APIError_channel_unavailable(err_conv);
25316 int64_t ret_ref = (uintptr_t)ret_copy;
25320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
25321 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25322 *ret_copy = APIError_monitor_update_failed();
25323 int64_t ret_ref = (uintptr_t)ret_copy;
25327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
25328 LDKShutdownScript script_conv;
25329 script_conv.inner = (void*)(script & (~1));
25330 script_conv.is_owned = (script & 1) || (script == 0);
25331 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
25332 script_conv = ShutdownScript_clone(&script_conv);
25333 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25334 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
25335 int64_t ret_ref = (uintptr_t)ret_copy;
25339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25340 LDKBigSize this_obj_conv;
25341 this_obj_conv.inner = (void*)(this_obj & (~1));
25342 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25344 BigSize_free(this_obj_conv);
25347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
25348 LDKBigSize this_ptr_conv;
25349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25350 this_ptr_conv.is_owned = false;
25351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25352 int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
25356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25357 LDKBigSize this_ptr_conv;
25358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25359 this_ptr_conv.is_owned = false;
25360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25361 BigSize_set_a(&this_ptr_conv, val);
25364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
25365 LDKBigSize ret_var = BigSize_new(a_arg);
25366 int64_t ret_ref = 0;
25367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25370 ret_ref = (uintptr_t)ret_var.inner;
25371 if (ret_var.is_owned) {
25377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25378 LDKHostname this_obj_conv;
25379 this_obj_conv.inner = (void*)(this_obj & (~1));
25380 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25382 Hostname_free(this_obj_conv);
25385 static inline uintptr_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
25386 LDKHostname ret_var = Hostname_clone(arg);
25387 int64_t ret_ref = 0;
25388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25391 ret_ref = (uintptr_t)ret_var.inner;
25392 if (ret_var.is_owned) {
25397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25398 LDKHostname arg_conv;
25399 arg_conv.inner = (void*)(arg & (~1));
25400 arg_conv.is_owned = false;
25401 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25402 int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
25406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25407 LDKHostname orig_conv;
25408 orig_conv.inner = (void*)(orig & (~1));
25409 orig_conv.is_owned = false;
25410 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25411 LDKHostname ret_var = Hostname_clone(&orig_conv);
25412 int64_t ret_ref = 0;
25413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25416 ret_ref = (uintptr_t)ret_var.inner;
25417 if (ret_var.is_owned) {
25423 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
25424 LDKHostname this_arg_conv;
25425 this_arg_conv.inner = (void*)(this_arg & (~1));
25426 this_arg_conv.is_owned = false;
25427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25428 int8_t ret_conv = Hostname_len(&this_arg_conv);
25432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
25433 LDKu8slice msg_ref;
25434 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25435 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25436 unsigned char sk_arr[32];
25437 CHECK((*env)->GetArrayLength(env, sk) == 32);
25438 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
25439 unsigned char (*sk_ref)[32] = &sk_arr;
25440 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
25441 *ret_conv = sign(msg_ref, sk_ref);
25442 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25443 return (int64_t)ret_conv;
25446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
25447 LDKu8slice msg_ref;
25448 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25449 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25450 LDKStr sig_conv = java_to_owned_str(env, sig);
25451 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
25452 *ret_conv = recover_pk(msg_ref, sig_conv);
25453 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25454 return (int64_t)ret_conv;
25457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
25458 LDKu8slice msg_ref;
25459 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25460 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25461 LDKStr sig_conv = java_to_owned_str(env, sig);
25462 LDKPublicKey pk_ref;
25463 CHECK((*env)->GetArrayLength(env, pk) == 33);
25464 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
25465 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
25466 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
25471 LDKu8slice hrp_bytes_ref;
25472 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
25473 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
25474 LDKCVec_u5Z data_without_signature_constr;
25475 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
25476 if (data_without_signature_constr.datalen > 0)
25477 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
25479 data_without_signature_constr.data = NULL;
25480 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
25481 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
25482 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
25484 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
25486 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
25487 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
25488 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25489 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25490 CVec_u8Z_free(ret_var);
25491 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
25495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25496 if ((this_ptr & 1) != 0) return;
25497 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25498 CHECK_ACCESS(this_ptr_ptr);
25499 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
25500 FREE((void*)this_ptr);
25501 Persister_free(this_ptr_conv);
25504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25505 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
25506 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
25510 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
25511 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
25515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
25516 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
25520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
25521 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
25525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
25526 jclass ret_conv = LDKLevel_to_java(env, Level_info());
25530 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
25531 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
25535 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
25536 jclass ret_conv = LDKLevel_to_java(env, Level_error());
25540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25541 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
25542 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
25543 jboolean ret_conv = Level_eq(a_conv, b_conv);
25547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
25548 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
25549 int64_t ret_conv = Level_hash(o_conv);
25553 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
25554 jclass ret_conv = LDKLevel_to_java(env, Level_max());
25558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25559 LDKRecord this_obj_conv;
25560 this_obj_conv.inner = (void*)(this_obj & (~1));
25561 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25563 Record_free(this_obj_conv);
25566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
25567 LDKRecord this_ptr_conv;
25568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25569 this_ptr_conv.is_owned = false;
25570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25571 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
25575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
25576 LDKRecord this_ptr_conv;
25577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25578 this_ptr_conv.is_owned = false;
25579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25580 LDKLevel val_conv = LDKLevel_from_java(env, val);
25581 Record_set_level(&this_ptr_conv, val_conv);
25584 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
25585 LDKRecord this_ptr_conv;
25586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25587 this_ptr_conv.is_owned = false;
25588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25589 LDKStr ret_str = Record_get_args(&this_ptr_conv);
25590 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
25596 LDKRecord this_ptr_conv;
25597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25598 this_ptr_conv.is_owned = false;
25599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25600 LDKStr val_conv = java_to_owned_str(env, val);
25601 Record_set_args(&this_ptr_conv, val_conv);
25604 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
25605 LDKRecord this_ptr_conv;
25606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25607 this_ptr_conv.is_owned = false;
25608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25609 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
25610 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
25616 LDKRecord this_ptr_conv;
25617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25618 this_ptr_conv.is_owned = false;
25619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25620 LDKStr val_conv = java_to_owned_str(env, val);
25621 Record_set_module_path(&this_ptr_conv, val_conv);
25624 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
25625 LDKRecord this_ptr_conv;
25626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25627 this_ptr_conv.is_owned = false;
25628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25629 LDKStr ret_str = Record_get_file(&this_ptr_conv);
25630 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
25636 LDKRecord this_ptr_conv;
25637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25638 this_ptr_conv.is_owned = false;
25639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25640 LDKStr val_conv = java_to_owned_str(env, val);
25641 Record_set_file(&this_ptr_conv, val_conv);
25644 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
25645 LDKRecord this_ptr_conv;
25646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25647 this_ptr_conv.is_owned = false;
25648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25649 int32_t ret_conv = Record_get_line(&this_ptr_conv);
25653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25654 LDKRecord this_ptr_conv;
25655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25656 this_ptr_conv.is_owned = false;
25657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25658 Record_set_line(&this_ptr_conv, val);
25661 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
25662 LDKRecord ret_var = Record_clone(arg);
25663 int64_t ret_ref = 0;
25664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25667 ret_ref = (uintptr_t)ret_var.inner;
25668 if (ret_var.is_owned) {
25673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25674 LDKRecord arg_conv;
25675 arg_conv.inner = (void*)(arg & (~1));
25676 arg_conv.is_owned = false;
25677 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25678 int64_t ret_conv = Record_clone_ptr(&arg_conv);
25682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25683 LDKRecord orig_conv;
25684 orig_conv.inner = (void*)(orig & (~1));
25685 orig_conv.is_owned = false;
25686 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25687 LDKRecord ret_var = Record_clone(&orig_conv);
25688 int64_t ret_ref = 0;
25689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25692 ret_ref = (uintptr_t)ret_var.inner;
25693 if (ret_var.is_owned) {
25699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25700 if ((this_ptr & 1) != 0) return;
25701 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25702 CHECK_ACCESS(this_ptr_ptr);
25703 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
25704 FREE((void*)this_ptr);
25705 Logger_free(this_ptr_conv);
25708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25709 LDKChannelHandshakeConfig this_obj_conv;
25710 this_obj_conv.inner = (void*)(this_obj & (~1));
25711 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25713 ChannelHandshakeConfig_free(this_obj_conv);
25716 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
25717 LDKChannelHandshakeConfig this_ptr_conv;
25718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25719 this_ptr_conv.is_owned = false;
25720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25721 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
25725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25726 LDKChannelHandshakeConfig this_ptr_conv;
25727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25728 this_ptr_conv.is_owned = false;
25729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25730 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
25733 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25734 LDKChannelHandshakeConfig this_ptr_conv;
25735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25736 this_ptr_conv.is_owned = false;
25737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25738 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
25742 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) {
25743 LDKChannelHandshakeConfig this_ptr_conv;
25744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25745 this_ptr_conv.is_owned = false;
25746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25747 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
25750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25751 LDKChannelHandshakeConfig this_ptr_conv;
25752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25753 this_ptr_conv.is_owned = false;
25754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25755 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
25759 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) {
25760 LDKChannelHandshakeConfig this_ptr_conv;
25761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25762 this_ptr_conv.is_owned = false;
25763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25764 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
25767 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
25768 LDKChannelHandshakeConfig this_ptr_conv;
25769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25770 this_ptr_conv.is_owned = false;
25771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25772 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
25776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
25777 LDKChannelHandshakeConfig this_ptr_conv;
25778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25779 this_ptr_conv.is_owned = false;
25780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25781 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
25784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
25785 LDKChannelHandshakeConfig this_ptr_conv;
25786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25787 this_ptr_conv.is_owned = false;
25788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25789 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
25793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25794 LDKChannelHandshakeConfig this_ptr_conv;
25795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25796 this_ptr_conv.is_owned = false;
25797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25798 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
25801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
25802 LDKChannelHandshakeConfig this_ptr_conv;
25803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25804 this_ptr_conv.is_owned = false;
25805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25806 jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
25810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25811 LDKChannelHandshakeConfig this_ptr_conv;
25812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25813 this_ptr_conv.is_owned = false;
25814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25815 ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
25818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25819 LDKChannelHandshakeConfig this_ptr_conv;
25820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25821 this_ptr_conv.is_owned = false;
25822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25823 jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
25827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25828 LDKChannelHandshakeConfig this_ptr_conv;
25829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25830 this_ptr_conv.is_owned = false;
25831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25832 ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
25835 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, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
25836 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
25837 int64_t ret_ref = 0;
25838 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25839 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25841 ret_ref = (uintptr_t)ret_var.inner;
25842 if (ret_var.is_owned) {
25848 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
25849 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
25850 int64_t ret_ref = 0;
25851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25854 ret_ref = (uintptr_t)ret_var.inner;
25855 if (ret_var.is_owned) {
25860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25861 LDKChannelHandshakeConfig arg_conv;
25862 arg_conv.inner = (void*)(arg & (~1));
25863 arg_conv.is_owned = false;
25864 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25865 int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
25869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25870 LDKChannelHandshakeConfig orig_conv;
25871 orig_conv.inner = (void*)(orig & (~1));
25872 orig_conv.is_owned = false;
25873 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25874 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
25875 int64_t ret_ref = 0;
25876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25879 ret_ref = (uintptr_t)ret_var.inner;
25880 if (ret_var.is_owned) {
25886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
25887 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
25888 int64_t ret_ref = 0;
25889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25892 ret_ref = (uintptr_t)ret_var.inner;
25893 if (ret_var.is_owned) {
25899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25900 LDKChannelHandshakeLimits this_obj_conv;
25901 this_obj_conv.inner = (void*)(this_obj & (~1));
25902 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25904 ChannelHandshakeLimits_free(this_obj_conv);
25907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25908 LDKChannelHandshakeLimits this_ptr_conv;
25909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25910 this_ptr_conv.is_owned = false;
25911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25912 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
25916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25917 LDKChannelHandshakeLimits this_ptr_conv;
25918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25919 this_ptr_conv.is_owned = false;
25920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25921 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
25924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25925 LDKChannelHandshakeLimits this_ptr_conv;
25926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25927 this_ptr_conv.is_owned = false;
25928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25929 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
25933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25934 LDKChannelHandshakeLimits this_ptr_conv;
25935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25936 this_ptr_conv.is_owned = false;
25937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25938 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
25941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25942 LDKChannelHandshakeLimits this_ptr_conv;
25943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25944 this_ptr_conv.is_owned = false;
25945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25946 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
25950 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) {
25951 LDKChannelHandshakeLimits this_ptr_conv;
25952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25953 this_ptr_conv.is_owned = false;
25954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25955 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
25958 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) {
25959 LDKChannelHandshakeLimits this_ptr_conv;
25960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25961 this_ptr_conv.is_owned = false;
25962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25963 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
25967 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) {
25968 LDKChannelHandshakeLimits this_ptr_conv;
25969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25970 this_ptr_conv.is_owned = false;
25971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25972 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
25975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25976 LDKChannelHandshakeLimits this_ptr_conv;
25977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25978 this_ptr_conv.is_owned = false;
25979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25980 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
25984 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) {
25985 LDKChannelHandshakeLimits this_ptr_conv;
25986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25987 this_ptr_conv.is_owned = false;
25988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25989 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
25992 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25993 LDKChannelHandshakeLimits this_ptr_conv;
25994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25995 this_ptr_conv.is_owned = false;
25996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25997 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
26001 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) {
26002 LDKChannelHandshakeLimits this_ptr_conv;
26003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26004 this_ptr_conv.is_owned = false;
26005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26006 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
26009 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
26010 LDKChannelHandshakeLimits this_ptr_conv;
26011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26012 this_ptr_conv.is_owned = false;
26013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26014 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
26018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26019 LDKChannelHandshakeLimits this_ptr_conv;
26020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26021 this_ptr_conv.is_owned = false;
26022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26023 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
26026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
26027 LDKChannelHandshakeLimits this_ptr_conv;
26028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26029 this_ptr_conv.is_owned = false;
26030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26031 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
26035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26036 LDKChannelHandshakeLimits this_ptr_conv;
26037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26038 this_ptr_conv.is_owned = false;
26039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26040 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
26043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
26044 LDKChannelHandshakeLimits this_ptr_conv;
26045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26046 this_ptr_conv.is_owned = false;
26047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26048 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
26052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26053 LDKChannelHandshakeLimits this_ptr_conv;
26054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26055 this_ptr_conv.is_owned = false;
26056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26057 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
26060 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26061 LDKChannelHandshakeLimits this_ptr_conv;
26062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26063 this_ptr_conv.is_owned = false;
26064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26065 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
26069 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) {
26070 LDKChannelHandshakeLimits this_ptr_conv;
26071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26072 this_ptr_conv.is_owned = false;
26073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26074 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
26077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_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 trust_own_funding_0conf_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
26078 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_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, trust_own_funding_0conf_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
26079 int64_t ret_ref = 0;
26080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26083 ret_ref = (uintptr_t)ret_var.inner;
26084 if (ret_var.is_owned) {
26090 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
26091 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
26092 int64_t ret_ref = 0;
26093 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26094 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26096 ret_ref = (uintptr_t)ret_var.inner;
26097 if (ret_var.is_owned) {
26102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26103 LDKChannelHandshakeLimits arg_conv;
26104 arg_conv.inner = (void*)(arg & (~1));
26105 arg_conv.is_owned = false;
26106 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26107 int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
26111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26112 LDKChannelHandshakeLimits orig_conv;
26113 orig_conv.inner = (void*)(orig & (~1));
26114 orig_conv.is_owned = false;
26115 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26116 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
26117 int64_t ret_ref = 0;
26118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26121 ret_ref = (uintptr_t)ret_var.inner;
26122 if (ret_var.is_owned) {
26128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
26129 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
26130 int64_t ret_ref = 0;
26131 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26132 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26134 ret_ref = (uintptr_t)ret_var.inner;
26135 if (ret_var.is_owned) {
26141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26142 LDKChannelConfig this_obj_conv;
26143 this_obj_conv.inner = (void*)(this_obj & (~1));
26144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26146 ChannelConfig_free(this_obj_conv);
26149 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26150 LDKChannelConfig this_ptr_conv;
26151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26152 this_ptr_conv.is_owned = false;
26153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26154 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
26158 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) {
26159 LDKChannelConfig this_ptr_conv;
26160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26161 this_ptr_conv.is_owned = false;
26162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26163 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
26166 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26167 LDKChannelConfig this_ptr_conv;
26168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26169 this_ptr_conv.is_owned = false;
26170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26171 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
26175 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) {
26176 LDKChannelConfig this_ptr_conv;
26177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26178 this_ptr_conv.is_owned = false;
26179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26180 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
26183 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26184 LDKChannelConfig this_ptr_conv;
26185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26186 this_ptr_conv.is_owned = false;
26187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26188 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
26192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26193 LDKChannelConfig this_ptr_conv;
26194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26195 this_ptr_conv.is_owned = false;
26196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26197 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
26200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26201 LDKChannelConfig this_ptr_conv;
26202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26203 this_ptr_conv.is_owned = false;
26204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26205 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
26209 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) {
26210 LDKChannelConfig this_ptr_conv;
26211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26212 this_ptr_conv.is_owned = false;
26213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26214 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
26217 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) {
26218 LDKChannelConfig this_ptr_conv;
26219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26220 this_ptr_conv.is_owned = false;
26221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26222 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
26226 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) {
26227 LDKChannelConfig this_ptr_conv;
26228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26229 this_ptr_conv.is_owned = false;
26230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26231 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
26234 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, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
26235 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
26236 int64_t ret_ref = 0;
26237 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26238 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26240 ret_ref = (uintptr_t)ret_var.inner;
26241 if (ret_var.is_owned) {
26247 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
26248 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
26249 int64_t ret_ref = 0;
26250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26253 ret_ref = (uintptr_t)ret_var.inner;
26254 if (ret_var.is_owned) {
26259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26260 LDKChannelConfig arg_conv;
26261 arg_conv.inner = (void*)(arg & (~1));
26262 arg_conv.is_owned = false;
26263 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26264 int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
26268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26269 LDKChannelConfig orig_conv;
26270 orig_conv.inner = (void*)(orig & (~1));
26271 orig_conv.is_owned = false;
26272 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26273 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
26274 int64_t ret_ref = 0;
26275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26278 ret_ref = (uintptr_t)ret_var.inner;
26279 if (ret_var.is_owned) {
26285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
26286 LDKChannelConfig ret_var = ChannelConfig_default();
26287 int64_t ret_ref = 0;
26288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26291 ret_ref = (uintptr_t)ret_var.inner;
26292 if (ret_var.is_owned) {
26298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
26299 LDKChannelConfig obj_conv;
26300 obj_conv.inner = (void*)(obj & (~1));
26301 obj_conv.is_owned = false;
26302 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26303 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
26304 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26305 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26306 CVec_u8Z_free(ret_var);
26310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26311 LDKu8slice ser_ref;
26312 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26313 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26314 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26315 *ret_conv = ChannelConfig_read(ser_ref);
26316 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26317 return (int64_t)ret_conv;
26320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26321 LDKUserConfig this_obj_conv;
26322 this_obj_conv.inner = (void*)(this_obj & (~1));
26323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26325 UserConfig_free(this_obj_conv);
26328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
26329 LDKUserConfig this_ptr_conv;
26330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26331 this_ptr_conv.is_owned = false;
26332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26333 LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
26334 int64_t ret_ref = 0;
26335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26338 ret_ref = (uintptr_t)ret_var.inner;
26339 if (ret_var.is_owned) {
26345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26346 LDKUserConfig this_ptr_conv;
26347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26348 this_ptr_conv.is_owned = false;
26349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26350 LDKChannelHandshakeConfig val_conv;
26351 val_conv.inner = (void*)(val & (~1));
26352 val_conv.is_owned = (val & 1) || (val == 0);
26353 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26354 val_conv = ChannelHandshakeConfig_clone(&val_conv);
26355 UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
26358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
26359 LDKUserConfig this_ptr_conv;
26360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26361 this_ptr_conv.is_owned = false;
26362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26363 LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
26364 int64_t ret_ref = 0;
26365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26368 ret_ref = (uintptr_t)ret_var.inner;
26369 if (ret_var.is_owned) {
26375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26376 LDKUserConfig this_ptr_conv;
26377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26378 this_ptr_conv.is_owned = false;
26379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26380 LDKChannelHandshakeLimits val_conv;
26381 val_conv.inner = (void*)(val & (~1));
26382 val_conv.is_owned = (val & 1) || (val == 0);
26383 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26384 val_conv = ChannelHandshakeLimits_clone(&val_conv);
26385 UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
26388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
26389 LDKUserConfig this_ptr_conv;
26390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26391 this_ptr_conv.is_owned = false;
26392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26393 LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
26394 int64_t ret_ref = 0;
26395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26398 ret_ref = (uintptr_t)ret_var.inner;
26399 if (ret_var.is_owned) {
26405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26406 LDKUserConfig this_ptr_conv;
26407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26408 this_ptr_conv.is_owned = false;
26409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26410 LDKChannelConfig val_conv;
26411 val_conv.inner = (void*)(val & (~1));
26412 val_conv.is_owned = (val & 1) || (val == 0);
26413 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26414 val_conv = ChannelConfig_clone(&val_conv);
26415 UserConfig_set_channel_config(&this_ptr_conv, val_conv);
26418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
26419 LDKUserConfig this_ptr_conv;
26420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26421 this_ptr_conv.is_owned = false;
26422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26423 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
26427 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) {
26428 LDKUserConfig this_ptr_conv;
26429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26430 this_ptr_conv.is_owned = false;
26431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26432 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
26435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
26436 LDKUserConfig this_ptr_conv;
26437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26438 this_ptr_conv.is_owned = false;
26439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26440 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
26444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26445 LDKUserConfig 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 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
26452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
26453 LDKUserConfig this_ptr_conv;
26454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26455 this_ptr_conv.is_owned = false;
26456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26457 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
26461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26462 LDKUserConfig this_ptr_conv;
26463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26464 this_ptr_conv.is_owned = false;
26465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26466 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
26469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t channel_handshake_config_arg, int64_t channel_handshake_limits_arg, int64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) {
26470 LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
26471 channel_handshake_config_arg_conv.inner = (void*)(channel_handshake_config_arg & (~1));
26472 channel_handshake_config_arg_conv.is_owned = (channel_handshake_config_arg & 1) || (channel_handshake_config_arg == 0);
26473 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
26474 channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
26475 LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
26476 channel_handshake_limits_arg_conv.inner = (void*)(channel_handshake_limits_arg & (~1));
26477 channel_handshake_limits_arg_conv.is_owned = (channel_handshake_limits_arg & 1) || (channel_handshake_limits_arg == 0);
26478 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
26479 channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
26480 LDKChannelConfig channel_config_arg_conv;
26481 channel_config_arg_conv.inner = (void*)(channel_config_arg & (~1));
26482 channel_config_arg_conv.is_owned = (channel_config_arg & 1) || (channel_config_arg == 0);
26483 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
26484 channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
26485 LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg);
26486 int64_t ret_ref = 0;
26487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26490 ret_ref = (uintptr_t)ret_var.inner;
26491 if (ret_var.is_owned) {
26497 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
26498 LDKUserConfig ret_var = UserConfig_clone(arg);
26499 int64_t ret_ref = 0;
26500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26503 ret_ref = (uintptr_t)ret_var.inner;
26504 if (ret_var.is_owned) {
26509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26510 LDKUserConfig arg_conv;
26511 arg_conv.inner = (void*)(arg & (~1));
26512 arg_conv.is_owned = false;
26513 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26514 int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
26518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26519 LDKUserConfig orig_conv;
26520 orig_conv.inner = (void*)(orig & (~1));
26521 orig_conv.is_owned = false;
26522 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26523 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
26524 int64_t ret_ref = 0;
26525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26528 ret_ref = (uintptr_t)ret_var.inner;
26529 if (ret_var.is_owned) {
26535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
26536 LDKUserConfig ret_var = UserConfig_default();
26537 int64_t ret_ref = 0;
26538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26541 ret_ref = (uintptr_t)ret_var.inner;
26542 if (ret_var.is_owned) {
26548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26549 LDKBestBlock this_obj_conv;
26550 this_obj_conv.inner = (void*)(this_obj & (~1));
26551 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26553 BestBlock_free(this_obj_conv);
26556 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
26557 LDKBestBlock ret_var = BestBlock_clone(arg);
26558 int64_t ret_ref = 0;
26559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26562 ret_ref = (uintptr_t)ret_var.inner;
26563 if (ret_var.is_owned) {
26568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26569 LDKBestBlock arg_conv;
26570 arg_conv.inner = (void*)(arg & (~1));
26571 arg_conv.is_owned = false;
26572 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26573 int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
26577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26578 LDKBestBlock orig_conv;
26579 orig_conv.inner = (void*)(orig & (~1));
26580 orig_conv.is_owned = false;
26581 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26582 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
26583 int64_t ret_ref = 0;
26584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26587 ret_ref = (uintptr_t)ret_var.inner;
26588 if (ret_var.is_owned) {
26594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
26595 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
26596 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
26597 int64_t ret_ref = 0;
26598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26601 ret_ref = (uintptr_t)ret_var.inner;
26602 if (ret_var.is_owned) {
26608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
26609 LDKThirtyTwoBytes block_hash_ref;
26610 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
26611 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
26612 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
26613 int64_t ret_ref = 0;
26614 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26615 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26617 ret_ref = (uintptr_t)ret_var.inner;
26618 if (ret_var.is_owned) {
26624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
26625 LDKBestBlock this_arg_conv;
26626 this_arg_conv.inner = (void*)(this_arg & (~1));
26627 this_arg_conv.is_owned = false;
26628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26629 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26630 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
26634 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
26635 LDKBestBlock this_arg_conv;
26636 this_arg_conv.inner = (void*)(this_arg & (~1));
26637 this_arg_conv.is_owned = false;
26638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26639 int32_t ret_conv = BestBlock_height(&this_arg_conv);
26643 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26644 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
26645 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
26649 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
26650 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
26654 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
26655 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
26659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26660 if ((this_ptr & 1) != 0) return;
26661 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26662 CHECK_ACCESS(this_ptr_ptr);
26663 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
26664 FREE((void*)this_ptr);
26665 Access_free(this_ptr_conv);
26668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26669 if ((this_ptr & 1) != 0) return;
26670 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26671 CHECK_ACCESS(this_ptr_ptr);
26672 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
26673 FREE((void*)this_ptr);
26674 Listen_free(this_ptr_conv);
26677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26678 if ((this_ptr & 1) != 0) return;
26679 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26680 CHECK_ACCESS(this_ptr_ptr);
26681 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
26682 FREE((void*)this_ptr);
26683 Confirm_free(this_ptr_conv);
26686 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26687 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
26688 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
26692 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
26693 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
26697 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
26698 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
26702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26703 if ((this_ptr & 1) != 0) return;
26704 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26705 CHECK_ACCESS(this_ptr_ptr);
26706 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
26707 FREE((void*)this_ptr);
26708 Watch_free(this_ptr_conv);
26711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26712 if ((this_ptr & 1) != 0) return;
26713 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26714 CHECK_ACCESS(this_ptr_ptr);
26715 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
26716 FREE((void*)this_ptr);
26717 Filter_free(this_ptr_conv);
26720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26721 LDKWatchedOutput this_obj_conv;
26722 this_obj_conv.inner = (void*)(this_obj & (~1));
26723 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26725 WatchedOutput_free(this_obj_conv);
26728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
26729 LDKWatchedOutput this_ptr_conv;
26730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26731 this_ptr_conv.is_owned = false;
26732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26733 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26734 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
26738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26739 LDKWatchedOutput this_ptr_conv;
26740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26741 this_ptr_conv.is_owned = false;
26742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26743 LDKThirtyTwoBytes val_ref;
26744 CHECK((*env)->GetArrayLength(env, val) == 32);
26745 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26746 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
26749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26750 LDKWatchedOutput this_ptr_conv;
26751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26752 this_ptr_conv.is_owned = false;
26753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26754 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
26755 int64_t ret_ref = 0;
26756 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26757 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26759 ret_ref = (uintptr_t)ret_var.inner;
26760 if (ret_var.is_owned) {
26766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26767 LDKWatchedOutput this_ptr_conv;
26768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26769 this_ptr_conv.is_owned = false;
26770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26771 LDKOutPoint val_conv;
26772 val_conv.inner = (void*)(val & (~1));
26773 val_conv.is_owned = (val & 1) || (val == 0);
26774 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26775 val_conv = OutPoint_clone(&val_conv);
26776 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
26779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26780 LDKWatchedOutput this_ptr_conv;
26781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26782 this_ptr_conv.is_owned = false;
26783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26784 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
26785 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26786 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26791 LDKWatchedOutput this_ptr_conv;
26792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26793 this_ptr_conv.is_owned = false;
26794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26795 LDKCVec_u8Z val_ref;
26796 val_ref.datalen = (*env)->GetArrayLength(env, val);
26797 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
26798 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26799 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
26802 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) {
26803 LDKThirtyTwoBytes block_hash_arg_ref;
26804 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
26805 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
26806 LDKOutPoint outpoint_arg_conv;
26807 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26808 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26809 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26810 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26811 LDKCVec_u8Z script_pubkey_arg_ref;
26812 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
26813 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
26814 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
26815 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
26816 int64_t ret_ref = 0;
26817 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26818 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26819 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26820 ret_ref = (uintptr_t)ret_var.inner;
26821 if (ret_var.is_owned) {
26827 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
26828 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
26829 int64_t ret_ref = 0;
26830 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26831 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26833 ret_ref = (uintptr_t)ret_var.inner;
26834 if (ret_var.is_owned) {
26839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26840 LDKWatchedOutput arg_conv;
26841 arg_conv.inner = (void*)(arg & (~1));
26842 arg_conv.is_owned = false;
26843 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26844 int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
26848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26849 LDKWatchedOutput orig_conv;
26850 orig_conv.inner = (void*)(orig & (~1));
26851 orig_conv.is_owned = false;
26852 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26853 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
26854 int64_t ret_ref = 0;
26855 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26856 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26858 ret_ref = (uintptr_t)ret_var.inner;
26859 if (ret_var.is_owned) {
26865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
26866 LDKWatchedOutput o_conv;
26867 o_conv.inner = (void*)(o & (~1));
26868 o_conv.is_owned = false;
26869 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26870 int64_t ret_conv = WatchedOutput_hash(&o_conv);
26874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26875 if ((this_ptr & 1) != 0) return;
26876 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26877 CHECK_ACCESS(this_ptr_ptr);
26878 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
26879 FREE((void*)this_ptr);
26880 BroadcasterInterface_free(this_ptr_conv);
26883 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26884 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
26885 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
26889 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
26890 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
26894 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
26895 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
26899 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
26900 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
26904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26905 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
26906 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
26907 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
26911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26912 if ((this_ptr & 1) != 0) return;
26913 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26914 CHECK_ACCESS(this_ptr_ptr);
26915 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
26916 FREE((void*)this_ptr);
26917 FeeEstimator_free(this_ptr_conv);
26920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26921 LDKMonitorUpdateId this_obj_conv;
26922 this_obj_conv.inner = (void*)(this_obj & (~1));
26923 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26925 MonitorUpdateId_free(this_obj_conv);
26928 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
26929 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
26930 int64_t ret_ref = 0;
26931 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26932 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26934 ret_ref = (uintptr_t)ret_var.inner;
26935 if (ret_var.is_owned) {
26940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26941 LDKMonitorUpdateId arg_conv;
26942 arg_conv.inner = (void*)(arg & (~1));
26943 arg_conv.is_owned = false;
26944 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26945 int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
26949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26950 LDKMonitorUpdateId orig_conv;
26951 orig_conv.inner = (void*)(orig & (~1));
26952 orig_conv.is_owned = false;
26953 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26954 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
26955 int64_t ret_ref = 0;
26956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26959 ret_ref = (uintptr_t)ret_var.inner;
26960 if (ret_var.is_owned) {
26966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
26967 LDKMonitorUpdateId o_conv;
26968 o_conv.inner = (void*)(o & (~1));
26969 o_conv.is_owned = false;
26970 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26971 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
26975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26976 LDKMonitorUpdateId a_conv;
26977 a_conv.inner = (void*)(a & (~1));
26978 a_conv.is_owned = false;
26979 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26980 LDKMonitorUpdateId b_conv;
26981 b_conv.inner = (void*)(b & (~1));
26982 b_conv.is_owned = false;
26983 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26984 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
26988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26989 if ((this_ptr & 1) != 0) return;
26990 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26991 CHECK_ACCESS(this_ptr_ptr);
26992 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
26993 FREE((void*)this_ptr);
26994 Persist_free(this_ptr_conv);
26997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26998 LDKLockedChannelMonitor this_obj_conv;
26999 this_obj_conv.inner = (void*)(this_obj & (~1));
27000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27002 LockedChannelMonitor_free(this_obj_conv);
27005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27006 LDKChainMonitor this_obj_conv;
27007 this_obj_conv.inner = (void*)(this_obj & (~1));
27008 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27010 ChainMonitor_free(this_obj_conv);
27013 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) {
27014 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
27015 CHECK_ACCESS(chain_source_ptr);
27016 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
27017 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
27018 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
27019 // Manually implement clone for Java trait instances
27020 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
27021 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27022 LDKFilter_JCalls_cloned(&chain_source_conv.some);
27025 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27026 CHECK_ACCESS(broadcaster_ptr);
27027 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27028 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27029 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27030 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27032 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27033 CHECK_ACCESS(logger_ptr);
27034 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27035 if (logger_conv.free == LDKLogger_JCalls_free) {
27036 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27037 LDKLogger_JCalls_cloned(&logger_conv);
27039 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
27040 CHECK_ACCESS(feeest_ptr);
27041 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
27042 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
27043 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27044 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
27046 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
27047 CHECK_ACCESS(persister_ptr);
27048 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
27049 if (persister_conv.free == LDKPersist_JCalls_free) {
27050 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27051 LDKPersist_JCalls_cloned(&persister_conv);
27053 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
27054 int64_t ret_ref = 0;
27055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27058 ret_ref = (uintptr_t)ret_var.inner;
27059 if (ret_var.is_owned) {
27065 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) {
27066 LDKChainMonitor this_arg_conv;
27067 this_arg_conv.inner = (void*)(this_arg & (~1));
27068 this_arg_conv.is_owned = false;
27069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27070 LDKCVec_ChannelDetailsZ ignored_channels_constr;
27071 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
27072 if (ignored_channels_constr.datalen > 0)
27073 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27075 ignored_channels_constr.data = NULL;
27076 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
27077 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
27078 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
27079 LDKChannelDetails ignored_channels_conv_16_conv;
27080 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
27081 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
27082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
27083 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
27084 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
27086 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
27087 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
27088 int64_tArray ret_arr = NULL;
27089 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27090 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27091 for (size_t j = 0; j < ret_var.datalen; j++) {
27092 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27093 *ret_conv_9_copy = ret_var.data[j];
27094 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
27095 ret_arr_ptr[j] = ret_conv_9_ref;
27097 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27098 FREE(ret_var.data);
27102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
27103 LDKChainMonitor this_arg_conv;
27104 this_arg_conv.inner = (void*)(this_arg & (~1));
27105 this_arg_conv.is_owned = false;
27106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27107 LDKOutPoint funding_txo_conv;
27108 funding_txo_conv.inner = (void*)(funding_txo & (~1));
27109 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
27110 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27111 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27112 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
27113 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
27114 return (int64_t)ret_conv;
27117 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
27118 LDKChainMonitor this_arg_conv;
27119 this_arg_conv.inner = (void*)(this_arg & (~1));
27120 this_arg_conv.is_owned = false;
27121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27122 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
27123 int64_tArray ret_arr = NULL;
27124 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27125 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27126 for (size_t k = 0; k < ret_var.datalen; k++) {
27127 LDKOutPoint ret_conv_10_var = ret_var.data[k];
27128 int64_t ret_conv_10_ref = 0;
27129 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27130 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
27132 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
27133 if (ret_conv_10_var.is_owned) {
27134 ret_conv_10_ref |= 1;
27136 ret_arr_ptr[k] = ret_conv_10_ref;
27138 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27139 FREE(ret_var.data);
27143 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) {
27144 LDKChainMonitor this_arg_conv;
27145 this_arg_conv.inner = (void*)(this_arg & (~1));
27146 this_arg_conv.is_owned = false;
27147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27148 LDKOutPoint funding_txo_conv;
27149 funding_txo_conv.inner = (void*)(funding_txo & (~1));
27150 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
27151 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27152 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27153 LDKMonitorUpdateId completed_update_id_conv;
27154 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
27155 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
27156 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
27157 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
27158 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27159 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
27160 return (int64_t)ret_conv;
27163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
27164 LDKChainMonitor this_arg_conv;
27165 this_arg_conv.inner = (void*)(this_arg & (~1));
27166 this_arg_conv.is_owned = false;
27167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27168 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27169 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
27170 return (int64_t)ret_ret;
27173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
27174 LDKChainMonitor this_arg_conv;
27175 this_arg_conv.inner = (void*)(this_arg & (~1));
27176 this_arg_conv.is_owned = false;
27177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27178 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27179 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
27180 return (int64_t)ret_ret;
27183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
27184 LDKChainMonitor this_arg_conv;
27185 this_arg_conv.inner = (void*)(this_arg & (~1));
27186 this_arg_conv.is_owned = false;
27187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27188 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
27189 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
27190 return (int64_t)ret_ret;
27193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27194 LDKChainMonitor this_arg_conv;
27195 this_arg_conv.inner = (void*)(this_arg & (~1));
27196 this_arg_conv.is_owned = false;
27197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27198 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27199 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
27200 return (int64_t)ret_ret;
27203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27204 LDKChannelMonitorUpdate this_obj_conv;
27205 this_obj_conv.inner = (void*)(this_obj & (~1));
27206 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27208 ChannelMonitorUpdate_free(this_obj_conv);
27211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27212 LDKChannelMonitorUpdate this_ptr_conv;
27213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27214 this_ptr_conv.is_owned = false;
27215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27216 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
27220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27221 LDKChannelMonitorUpdate this_ptr_conv;
27222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27223 this_ptr_conv.is_owned = false;
27224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27225 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
27228 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
27229 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
27230 int64_t ret_ref = 0;
27231 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27232 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27234 ret_ref = (uintptr_t)ret_var.inner;
27235 if (ret_var.is_owned) {
27240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27241 LDKChannelMonitorUpdate arg_conv;
27242 arg_conv.inner = (void*)(arg & (~1));
27243 arg_conv.is_owned = false;
27244 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27245 int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
27249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27250 LDKChannelMonitorUpdate orig_conv;
27251 orig_conv.inner = (void*)(orig & (~1));
27252 orig_conv.is_owned = false;
27253 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27254 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
27255 int64_t ret_ref = 0;
27256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27259 ret_ref = (uintptr_t)ret_var.inner;
27260 if (ret_var.is_owned) {
27266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27267 LDKChannelMonitorUpdate obj_conv;
27268 obj_conv.inner = (void*)(obj & (~1));
27269 obj_conv.is_owned = false;
27270 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27271 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
27272 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27273 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27274 CVec_u8Z_free(ret_var);
27278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27279 LDKu8slice ser_ref;
27280 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27281 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27282 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27283 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
27284 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27285 return (int64_t)ret_conv;
27288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27289 if ((this_ptr & 1) != 0) return;
27290 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27291 CHECK_ACCESS(this_ptr_ptr);
27292 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
27293 FREE((void*)this_ptr);
27294 MonitorEvent_free(this_ptr_conv);
27297 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
27298 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27299 *ret_copy = MonitorEvent_clone(arg);
27300 int64_t ret_ref = (uintptr_t)ret_copy;
27303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27304 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
27305 int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
27309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27310 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
27311 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27312 *ret_copy = MonitorEvent_clone(orig_conv);
27313 int64_t ret_ref = (uintptr_t)ret_copy;
27317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
27318 LDKHTLCUpdate a_conv;
27319 a_conv.inner = (void*)(a & (~1));
27320 a_conv.is_owned = (a & 1) || (a == 0);
27321 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27322 a_conv = HTLCUpdate_clone(&a_conv);
27323 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27324 *ret_copy = MonitorEvent_htlcevent(a_conv);
27325 int64_t ret_ref = (uintptr_t)ret_copy;
27329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
27330 LDKOutPoint a_conv;
27331 a_conv.inner = (void*)(a & (~1));
27332 a_conv.is_owned = (a & 1) || (a == 0);
27333 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27334 a_conv = OutPoint_clone(&a_conv);
27335 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27336 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
27337 int64_t ret_ref = (uintptr_t)ret_copy;
27341 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) {
27342 LDKOutPoint funding_txo_conv;
27343 funding_txo_conv.inner = (void*)(funding_txo & (~1));
27344 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
27345 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27346 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27347 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27348 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
27349 int64_t ret_ref = (uintptr_t)ret_copy;
27353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
27354 LDKOutPoint a_conv;
27355 a_conv.inner = (void*)(a & (~1));
27356 a_conv.is_owned = (a & 1) || (a == 0);
27357 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27358 a_conv = OutPoint_clone(&a_conv);
27359 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27360 *ret_copy = MonitorEvent_update_failed(a_conv);
27361 int64_t ret_ref = (uintptr_t)ret_copy;
27365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
27366 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
27367 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
27368 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27369 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27370 CVec_u8Z_free(ret_var);
27374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27375 LDKu8slice ser_ref;
27376 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27377 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27378 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27379 *ret_conv = MonitorEvent_read(ser_ref);
27380 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27381 return (int64_t)ret_conv;
27384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27385 LDKHTLCUpdate this_obj_conv;
27386 this_obj_conv.inner = (void*)(this_obj & (~1));
27387 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27389 HTLCUpdate_free(this_obj_conv);
27392 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
27393 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
27394 int64_t ret_ref = 0;
27395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27398 ret_ref = (uintptr_t)ret_var.inner;
27399 if (ret_var.is_owned) {
27404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27405 LDKHTLCUpdate arg_conv;
27406 arg_conv.inner = (void*)(arg & (~1));
27407 arg_conv.is_owned = false;
27408 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27409 int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
27413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27414 LDKHTLCUpdate orig_conv;
27415 orig_conv.inner = (void*)(orig & (~1));
27416 orig_conv.is_owned = false;
27417 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27418 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
27419 int64_t ret_ref = 0;
27420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27423 ret_ref = (uintptr_t)ret_var.inner;
27424 if (ret_var.is_owned) {
27430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27431 LDKHTLCUpdate obj_conv;
27432 obj_conv.inner = (void*)(obj & (~1));
27433 obj_conv.is_owned = false;
27434 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27435 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
27436 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27437 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27438 CVec_u8Z_free(ret_var);
27442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27443 LDKu8slice ser_ref;
27444 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27445 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27446 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27447 *ret_conv = HTLCUpdate_read(ser_ref);
27448 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27449 return (int64_t)ret_conv;
27452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27453 if ((this_ptr & 1) != 0) return;
27454 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27455 CHECK_ACCESS(this_ptr_ptr);
27456 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
27457 FREE((void*)this_ptr);
27458 Balance_free(this_ptr_conv);
27461 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
27462 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27463 *ret_copy = Balance_clone(arg);
27464 int64_t ret_ref = (uintptr_t)ret_copy;
27467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27468 LDKBalance* arg_conv = (LDKBalance*)arg;
27469 int64_t ret_conv = Balance_clone_ptr(arg_conv);
27473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27474 LDKBalance* orig_conv = (LDKBalance*)orig;
27475 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27476 *ret_copy = Balance_clone(orig_conv);
27477 int64_t ret_ref = (uintptr_t)ret_copy;
27481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
27482 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27483 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
27484 int64_t ret_ref = (uintptr_t)ret_copy;
27488 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) {
27489 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27490 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
27491 int64_t ret_ref = (uintptr_t)ret_copy;
27495 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) {
27496 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27497 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
27498 int64_t ret_ref = (uintptr_t)ret_copy;
27502 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) {
27503 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27504 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
27505 int64_t ret_ref = (uintptr_t)ret_copy;
27509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27510 LDKBalance* a_conv = (LDKBalance*)a;
27511 LDKBalance* b_conv = (LDKBalance*)b;
27512 jboolean ret_conv = Balance_eq(a_conv, b_conv);
27516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27517 LDKChannelMonitor this_obj_conv;
27518 this_obj_conv.inner = (void*)(this_obj & (~1));
27519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27521 ChannelMonitor_free(this_obj_conv);
27524 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
27525 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
27526 int64_t ret_ref = 0;
27527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27530 ret_ref = (uintptr_t)ret_var.inner;
27531 if (ret_var.is_owned) {
27536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27537 LDKChannelMonitor arg_conv;
27538 arg_conv.inner = (void*)(arg & (~1));
27539 arg_conv.is_owned = false;
27540 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27541 int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
27545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27546 LDKChannelMonitor orig_conv;
27547 orig_conv.inner = (void*)(orig & (~1));
27548 orig_conv.is_owned = false;
27549 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27550 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
27551 int64_t ret_ref = 0;
27552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27555 ret_ref = (uintptr_t)ret_var.inner;
27556 if (ret_var.is_owned) {
27562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27563 LDKChannelMonitor obj_conv;
27564 obj_conv.inner = (void*)(obj & (~1));
27565 obj_conv.is_owned = false;
27566 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27567 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
27568 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27569 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27570 CVec_u8Z_free(ret_var);
27574 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) {
27575 LDKChannelMonitor this_arg_conv;
27576 this_arg_conv.inner = (void*)(this_arg & (~1));
27577 this_arg_conv.is_owned = false;
27578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27579 LDKChannelMonitorUpdate updates_conv;
27580 updates_conv.inner = (void*)(updates & (~1));
27581 updates_conv.is_owned = false;
27582 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
27583 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27584 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
27585 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
27586 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27587 CHECK_ACCESS(fee_estimator_ptr);
27588 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27589 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27590 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27591 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27593 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27594 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
27595 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
27596 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
27597 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
27598 return (int64_t)ret_conv;
27601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
27602 LDKChannelMonitor this_arg_conv;
27603 this_arg_conv.inner = (void*)(this_arg & (~1));
27604 this_arg_conv.is_owned = false;
27605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27606 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
27610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
27611 LDKChannelMonitor this_arg_conv;
27612 this_arg_conv.inner = (void*)(this_arg & (~1));
27613 this_arg_conv.is_owned = false;
27614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27615 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
27616 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
27617 return ((int64_t)ret_conv);
27620 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
27621 LDKChannelMonitor this_arg_conv;
27622 this_arg_conv.inner = (void*)(this_arg & (~1));
27623 this_arg_conv.is_owned = false;
27624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27625 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
27626 int64_tArray ret_arr = NULL;
27627 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27628 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27629 for (size_t o = 0; o < ret_var.datalen; o++) {
27630 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
27631 *ret_conv_40_conv = ret_var.data[o];
27632 ret_arr_ptr[o] = ((int64_t)ret_conv_40_conv);
27634 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27635 FREE(ret_var.data);
27639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
27640 LDKChannelMonitor this_arg_conv;
27641 this_arg_conv.inner = (void*)(this_arg & (~1));
27642 this_arg_conv.is_owned = false;
27643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27644 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
27645 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
27646 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
27647 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
27650 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
27651 LDKChannelMonitor this_arg_conv;
27652 this_arg_conv.inner = (void*)(this_arg & (~1));
27653 this_arg_conv.is_owned = false;
27654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27655 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
27656 int64_tArray ret_arr = NULL;
27657 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27658 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27659 for (size_t o = 0; o < ret_var.datalen; o++) {
27660 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27661 *ret_conv_14_copy = ret_var.data[o];
27662 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
27663 ret_arr_ptr[o] = ret_conv_14_ref;
27665 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27666 FREE(ret_var.data);
27670 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
27671 LDKChannelMonitor this_arg_conv;
27672 this_arg_conv.inner = (void*)(this_arg & (~1));
27673 this_arg_conv.is_owned = false;
27674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27675 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
27676 int64_tArray ret_arr = NULL;
27677 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27678 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27679 for (size_t h = 0; h < ret_var.datalen; h++) {
27680 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
27681 *ret_conv_7_copy = ret_var.data[h];
27682 int64_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
27683 ret_arr_ptr[h] = ret_conv_7_ref;
27685 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27686 FREE(ret_var.data);
27690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
27691 LDKChannelMonitor this_arg_conv;
27692 this_arg_conv.inner = (void*)(this_arg & (~1));
27693 this_arg_conv.is_owned = false;
27694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27695 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27696 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
27700 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) {
27701 LDKChannelMonitor this_arg_conv;
27702 this_arg_conv.inner = (void*)(this_arg & (~1));
27703 this_arg_conv.is_owned = false;
27704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27705 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27706 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
27707 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
27708 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
27709 jobjectArray ret_arr = NULL;
27710 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27712 for (size_t i = 0; i < ret_var.datalen; i++) {
27713 LDKTransaction ret_conv_8_var = ret_var.data[i];
27714 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
27715 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
27716 Transaction_free(ret_conv_8_var);
27717 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27720 FREE(ret_var.data);
27724 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) {
27725 LDKChannelMonitor this_arg_conv;
27726 this_arg_conv.inner = (void*)(this_arg & (~1));
27727 this_arg_conv.is_owned = false;
27728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27729 unsigned char header_arr[80];
27730 CHECK((*env)->GetArrayLength(env, header) == 80);
27731 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27732 unsigned char (*header_ref)[80] = &header_arr;
27733 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
27734 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
27735 if (txdata_constr.datalen > 0)
27736 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27738 txdata_constr.data = NULL;
27739 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
27740 for (size_t c = 0; c < txdata_constr.datalen; c++) {
27741 int64_t txdata_conv_28 = txdata_vals[c];
27742 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
27743 CHECK_ACCESS(txdata_conv_28_ptr);
27744 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
27745 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
27746 txdata_constr.data[c] = txdata_conv_28_conv;
27748 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
27749 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27750 CHECK_ACCESS(broadcaster_ptr);
27751 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27752 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27753 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27754 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27756 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27757 CHECK_ACCESS(fee_estimator_ptr);
27758 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27759 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27760 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27761 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27763 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27764 CHECK_ACCESS(logger_ptr);
27765 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27766 if (logger_conv.free == LDKLogger_JCalls_free) {
27767 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27768 LDKLogger_JCalls_cloned(&logger_conv);
27770 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);
27771 int64_tArray ret_arr = NULL;
27772 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27773 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27774 for (size_t n = 0; n < ret_var.datalen; n++) {
27775 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27776 *ret_conv_39_conv = ret_var.data[n];
27777 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27779 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27780 FREE(ret_var.data);
27784 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) {
27785 LDKChannelMonitor this_arg_conv;
27786 this_arg_conv.inner = (void*)(this_arg & (~1));
27787 this_arg_conv.is_owned = false;
27788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27789 unsigned char header_arr[80];
27790 CHECK((*env)->GetArrayLength(env, header) == 80);
27791 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27792 unsigned char (*header_ref)[80] = &header_arr;
27793 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27794 CHECK_ACCESS(broadcaster_ptr);
27795 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27796 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27797 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27798 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27800 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27801 CHECK_ACCESS(fee_estimator_ptr);
27802 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27803 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27804 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27805 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27807 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27808 CHECK_ACCESS(logger_ptr);
27809 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27810 if (logger_conv.free == LDKLogger_JCalls_free) {
27811 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27812 LDKLogger_JCalls_cloned(&logger_conv);
27814 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
27817 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) {
27818 LDKChannelMonitor this_arg_conv;
27819 this_arg_conv.inner = (void*)(this_arg & (~1));
27820 this_arg_conv.is_owned = false;
27821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27822 unsigned char header_arr[80];
27823 CHECK((*env)->GetArrayLength(env, header) == 80);
27824 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27825 unsigned char (*header_ref)[80] = &header_arr;
27826 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
27827 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
27828 if (txdata_constr.datalen > 0)
27829 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27831 txdata_constr.data = NULL;
27832 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
27833 for (size_t c = 0; c < txdata_constr.datalen; c++) {
27834 int64_t txdata_conv_28 = txdata_vals[c];
27835 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
27836 CHECK_ACCESS(txdata_conv_28_ptr);
27837 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
27838 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
27839 txdata_constr.data[c] = txdata_conv_28_conv;
27841 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
27842 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27843 CHECK_ACCESS(broadcaster_ptr);
27844 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27845 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27846 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27847 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27849 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27850 CHECK_ACCESS(fee_estimator_ptr);
27851 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27852 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27853 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27854 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27856 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27857 CHECK_ACCESS(logger_ptr);
27858 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27859 if (logger_conv.free == LDKLogger_JCalls_free) {
27860 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27861 LDKLogger_JCalls_cloned(&logger_conv);
27863 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);
27864 int64_tArray ret_arr = NULL;
27865 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27866 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27867 for (size_t n = 0; n < ret_var.datalen; n++) {
27868 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27869 *ret_conv_39_conv = ret_var.data[n];
27870 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27872 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27873 FREE(ret_var.data);
27877 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) {
27878 LDKChannelMonitor this_arg_conv;
27879 this_arg_conv.inner = (void*)(this_arg & (~1));
27880 this_arg_conv.is_owned = false;
27881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27882 unsigned char txid_arr[32];
27883 CHECK((*env)->GetArrayLength(env, txid) == 32);
27884 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
27885 unsigned char (*txid_ref)[32] = &txid_arr;
27886 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27887 CHECK_ACCESS(broadcaster_ptr);
27888 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27889 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27890 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27891 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27893 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27894 CHECK_ACCESS(fee_estimator_ptr);
27895 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27896 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27897 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27898 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27900 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27901 CHECK_ACCESS(logger_ptr);
27902 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27903 if (logger_conv.free == LDKLogger_JCalls_free) {
27904 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27905 LDKLogger_JCalls_cloned(&logger_conv);
27907 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
27910 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) {
27911 LDKChannelMonitor this_arg_conv;
27912 this_arg_conv.inner = (void*)(this_arg & (~1));
27913 this_arg_conv.is_owned = false;
27914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27915 unsigned char header_arr[80];
27916 CHECK((*env)->GetArrayLength(env, header) == 80);
27917 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
27918 unsigned char (*header_ref)[80] = &header_arr;
27919 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
27920 CHECK_ACCESS(broadcaster_ptr);
27921 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27922 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27923 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27924 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27926 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27927 CHECK_ACCESS(fee_estimator_ptr);
27928 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27929 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27930 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27931 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27933 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27934 CHECK_ACCESS(logger_ptr);
27935 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27936 if (logger_conv.free == LDKLogger_JCalls_free) {
27937 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27938 LDKLogger_JCalls_cloned(&logger_conv);
27940 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
27941 int64_tArray ret_arr = NULL;
27942 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27943 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27944 for (size_t n = 0; n < ret_var.datalen; n++) {
27945 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
27946 *ret_conv_39_conv = ret_var.data[n];
27947 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
27949 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27950 FREE(ret_var.data);
27954 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
27955 LDKChannelMonitor this_arg_conv;
27956 this_arg_conv.inner = (void*)(this_arg & (~1));
27957 this_arg_conv.is_owned = false;
27958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27959 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
27960 jobjectArray ret_arr = NULL;
27961 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27963 for (size_t i = 0; i < ret_var.datalen; i++) {
27964 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
27965 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
27966 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27969 FREE(ret_var.data);
27973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
27974 LDKChannelMonitor this_arg_conv;
27975 this_arg_conv.inner = (void*)(this_arg & (~1));
27976 this_arg_conv.is_owned = false;
27977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27978 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
27979 int64_t ret_ref = 0;
27980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27983 ret_ref = (uintptr_t)ret_var.inner;
27984 if (ret_var.is_owned) {
27990 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
27991 LDKChannelMonitor this_arg_conv;
27992 this_arg_conv.inner = (void*)(this_arg & (~1));
27993 this_arg_conv.is_owned = false;
27994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27995 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
27996 int64_tArray ret_arr = NULL;
27997 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27998 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27999 for (size_t j = 0; j < ret_var.datalen; j++) {
28000 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28001 *ret_conv_9_copy = ret_var.data[j];
28002 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
28003 ret_arr_ptr[j] = ret_conv_9_ref;
28005 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28006 FREE(ret_var.data);
28010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
28011 LDKu8slice ser_ref;
28012 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28013 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28014 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
28015 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28016 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
28017 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
28018 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
28019 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28020 return (int64_t)ret_conv;
28023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28024 LDKOutPoint this_obj_conv;
28025 this_obj_conv.inner = (void*)(this_obj & (~1));
28026 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28028 OutPoint_free(this_obj_conv);
28031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28032 LDKOutPoint this_ptr_conv;
28033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28034 this_ptr_conv.is_owned = false;
28035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28036 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28037 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
28041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28042 LDKOutPoint this_ptr_conv;
28043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28044 this_ptr_conv.is_owned = false;
28045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28046 LDKThirtyTwoBytes val_ref;
28047 CHECK((*env)->GetArrayLength(env, val) == 32);
28048 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28049 OutPoint_set_txid(&this_ptr_conv, val_ref);
28052 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
28053 LDKOutPoint this_ptr_conv;
28054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28055 this_ptr_conv.is_owned = false;
28056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28057 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
28061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28062 LDKOutPoint this_ptr_conv;
28063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28064 this_ptr_conv.is_owned = false;
28065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28066 OutPoint_set_index(&this_ptr_conv, val);
28069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
28070 LDKThirtyTwoBytes txid_arg_ref;
28071 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
28072 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
28073 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
28074 int64_t ret_ref = 0;
28075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28078 ret_ref = (uintptr_t)ret_var.inner;
28079 if (ret_var.is_owned) {
28085 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
28086 LDKOutPoint ret_var = OutPoint_clone(arg);
28087 int64_t ret_ref = 0;
28088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28091 ret_ref = (uintptr_t)ret_var.inner;
28092 if (ret_var.is_owned) {
28097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28098 LDKOutPoint arg_conv;
28099 arg_conv.inner = (void*)(arg & (~1));
28100 arg_conv.is_owned = false;
28101 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28102 int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
28106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28107 LDKOutPoint orig_conv;
28108 orig_conv.inner = (void*)(orig & (~1));
28109 orig_conv.is_owned = false;
28110 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28111 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
28112 int64_t ret_ref = 0;
28113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28116 ret_ref = (uintptr_t)ret_var.inner;
28117 if (ret_var.is_owned) {
28123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28124 LDKOutPoint a_conv;
28125 a_conv.inner = (void*)(a & (~1));
28126 a_conv.is_owned = false;
28127 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28128 LDKOutPoint b_conv;
28129 b_conv.inner = (void*)(b & (~1));
28130 b_conv.is_owned = false;
28131 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28132 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
28136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
28137 LDKOutPoint o_conv;
28138 o_conv.inner = (void*)(o & (~1));
28139 o_conv.is_owned = false;
28140 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28141 int64_t ret_conv = OutPoint_hash(&o_conv);
28145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
28146 LDKOutPoint this_arg_conv;
28147 this_arg_conv.inner = (void*)(this_arg & (~1));
28148 this_arg_conv.is_owned = false;
28149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28150 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28151 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
28155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
28156 LDKOutPoint obj_conv;
28157 obj_conv.inner = (void*)(obj & (~1));
28158 obj_conv.is_owned = false;
28159 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28160 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
28161 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28162 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28163 CVec_u8Z_free(ret_var);
28167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28168 LDKu8slice ser_ref;
28169 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28170 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28171 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28172 *ret_conv = OutPoint_read(ser_ref);
28173 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28174 return (int64_t)ret_conv;
28177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28178 LDKDelayedPaymentOutputDescriptor this_obj_conv;
28179 this_obj_conv.inner = (void*)(this_obj & (~1));
28180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28182 DelayedPaymentOutputDescriptor_free(this_obj_conv);
28185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28186 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28188 this_ptr_conv.is_owned = false;
28189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28190 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
28191 int64_t ret_ref = 0;
28192 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28193 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28194 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28195 ret_ref = (uintptr_t)ret_var.inner;
28196 if (ret_var.is_owned) {
28202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28203 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28205 this_ptr_conv.is_owned = false;
28206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28207 LDKOutPoint val_conv;
28208 val_conv.inner = (void*)(val & (~1));
28209 val_conv.is_owned = (val & 1) || (val == 0);
28210 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28211 val_conv = OutPoint_clone(&val_conv);
28212 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
28215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28216 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28218 this_ptr_conv.is_owned = false;
28219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28220 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
28225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28226 LDKDelayedPaymentOutputDescriptor 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 LDKPublicKey val_ref;
28231 CHECK((*env)->GetArrayLength(env, val) == 33);
28232 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28233 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
28236 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28237 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28239 this_ptr_conv.is_owned = false;
28240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28241 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
28245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28246 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28248 this_ptr_conv.is_owned = false;
28249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28250 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
28253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
28254 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28256 this_ptr_conv.is_owned = false;
28257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28258 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
28259 *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
28260 return (int64_t)ret_ref;
28263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28264 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28266 this_ptr_conv.is_owned = false;
28267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28268 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28269 CHECK_ACCESS(val_ptr);
28270 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
28271 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
28272 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
28275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28276 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28278 this_ptr_conv.is_owned = false;
28279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28280 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28281 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
28285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28286 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28288 this_ptr_conv.is_owned = false;
28289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28290 LDKPublicKey val_ref;
28291 CHECK((*env)->GetArrayLength(env, val) == 33);
28292 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28293 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
28296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28297 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28299 this_ptr_conv.is_owned = false;
28300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28301 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28302 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
28306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28307 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28309 this_ptr_conv.is_owned = false;
28310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28311 LDKThirtyTwoBytes val_ref;
28312 CHECK((*env)->GetArrayLength(env, val) == 32);
28313 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28314 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
28317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28318 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28320 this_ptr_conv.is_owned = false;
28321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28322 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
28326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28327 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28329 this_ptr_conv.is_owned = false;
28330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28331 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
28334 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) {
28335 LDKOutPoint outpoint_arg_conv;
28336 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
28337 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
28338 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
28339 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
28340 LDKPublicKey per_commitment_point_arg_ref;
28341 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
28342 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
28343 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
28344 CHECK_ACCESS(output_arg_ptr);
28345 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
28346 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
28347 LDKPublicKey revocation_pubkey_arg_ref;
28348 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
28349 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
28350 LDKThirtyTwoBytes channel_keys_id_arg_ref;
28351 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
28352 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
28353 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);
28354 int64_t ret_ref = 0;
28355 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28356 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28358 ret_ref = (uintptr_t)ret_var.inner;
28359 if (ret_var.is_owned) {
28365 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
28366 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
28367 int64_t ret_ref = 0;
28368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28371 ret_ref = (uintptr_t)ret_var.inner;
28372 if (ret_var.is_owned) {
28377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28378 LDKDelayedPaymentOutputDescriptor arg_conv;
28379 arg_conv.inner = (void*)(arg & (~1));
28380 arg_conv.is_owned = false;
28381 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28382 int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
28386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28387 LDKDelayedPaymentOutputDescriptor orig_conv;
28388 orig_conv.inner = (void*)(orig & (~1));
28389 orig_conv.is_owned = false;
28390 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28391 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
28392 int64_t ret_ref = 0;
28393 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28394 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28396 ret_ref = (uintptr_t)ret_var.inner;
28397 if (ret_var.is_owned) {
28403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28404 LDKDelayedPaymentOutputDescriptor obj_conv;
28405 obj_conv.inner = (void*)(obj & (~1));
28406 obj_conv.is_owned = false;
28407 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28408 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
28409 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28410 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28411 CVec_u8Z_free(ret_var);
28415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28416 LDKu8slice ser_ref;
28417 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28418 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28419 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
28420 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
28421 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28422 return (int64_t)ret_conv;
28425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28426 LDKStaticPaymentOutputDescriptor this_obj_conv;
28427 this_obj_conv.inner = (void*)(this_obj & (~1));
28428 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28430 StaticPaymentOutputDescriptor_free(this_obj_conv);
28433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28434 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28436 this_ptr_conv.is_owned = false;
28437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28438 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
28439 int64_t ret_ref = 0;
28440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28443 ret_ref = (uintptr_t)ret_var.inner;
28444 if (ret_var.is_owned) {
28450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28451 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28453 this_ptr_conv.is_owned = false;
28454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28455 LDKOutPoint val_conv;
28456 val_conv.inner = (void*)(val & (~1));
28457 val_conv.is_owned = (val & 1) || (val == 0);
28458 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28459 val_conv = OutPoint_clone(&val_conv);
28460 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
28463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
28464 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28466 this_ptr_conv.is_owned = false;
28467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28468 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
28469 *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
28470 return (int64_t)ret_ref;
28473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28474 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28476 this_ptr_conv.is_owned = false;
28477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28478 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28479 CHECK_ACCESS(val_ptr);
28480 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
28481 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
28482 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
28485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28486 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28488 this_ptr_conv.is_owned = false;
28489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28490 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28491 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
28495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28496 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28498 this_ptr_conv.is_owned = false;
28499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28500 LDKThirtyTwoBytes val_ref;
28501 CHECK((*env)->GetArrayLength(env, val) == 32);
28502 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28503 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
28506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28507 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28509 this_ptr_conv.is_owned = false;
28510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28511 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
28515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28516 LDKStaticPaymentOutputDescriptor this_ptr_conv;
28517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28518 this_ptr_conv.is_owned = false;
28519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28520 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
28523 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) {
28524 LDKOutPoint outpoint_arg_conv;
28525 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
28526 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
28527 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
28528 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
28529 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
28530 CHECK_ACCESS(output_arg_ptr);
28531 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
28532 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
28533 LDKThirtyTwoBytes channel_keys_id_arg_ref;
28534 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
28535 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
28536 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
28537 int64_t ret_ref = 0;
28538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28541 ret_ref = (uintptr_t)ret_var.inner;
28542 if (ret_var.is_owned) {
28548 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
28549 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
28550 int64_t ret_ref = 0;
28551 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28552 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28554 ret_ref = (uintptr_t)ret_var.inner;
28555 if (ret_var.is_owned) {
28560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28561 LDKStaticPaymentOutputDescriptor arg_conv;
28562 arg_conv.inner = (void*)(arg & (~1));
28563 arg_conv.is_owned = false;
28564 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28565 int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
28569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28570 LDKStaticPaymentOutputDescriptor orig_conv;
28571 orig_conv.inner = (void*)(orig & (~1));
28572 orig_conv.is_owned = false;
28573 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28574 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
28575 int64_t ret_ref = 0;
28576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28579 ret_ref = (uintptr_t)ret_var.inner;
28580 if (ret_var.is_owned) {
28586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28587 LDKStaticPaymentOutputDescriptor obj_conv;
28588 obj_conv.inner = (void*)(obj & (~1));
28589 obj_conv.is_owned = false;
28590 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28591 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
28592 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28593 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28594 CVec_u8Z_free(ret_var);
28598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28599 LDKu8slice ser_ref;
28600 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28601 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28602 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
28603 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
28604 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28605 return (int64_t)ret_conv;
28608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28609 if ((this_ptr & 1) != 0) return;
28610 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28611 CHECK_ACCESS(this_ptr_ptr);
28612 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
28613 FREE((void*)this_ptr);
28614 SpendableOutputDescriptor_free(this_ptr_conv);
28617 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
28618 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28619 *ret_copy = SpendableOutputDescriptor_clone(arg);
28620 int64_t ret_ref = (uintptr_t)ret_copy;
28623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28624 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
28625 int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
28629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28630 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
28631 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28632 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
28633 int64_t ret_ref = (uintptr_t)ret_copy;
28637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
28638 LDKOutPoint outpoint_conv;
28639 outpoint_conv.inner = (void*)(outpoint & (~1));
28640 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
28641 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
28642 outpoint_conv = OutPoint_clone(&outpoint_conv);
28643 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
28644 CHECK_ACCESS(output_ptr);
28645 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
28646 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
28647 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28648 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
28649 int64_t ret_ref = (uintptr_t)ret_copy;
28653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
28654 LDKDelayedPaymentOutputDescriptor a_conv;
28655 a_conv.inner = (void*)(a & (~1));
28656 a_conv.is_owned = (a & 1) || (a == 0);
28657 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28658 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
28659 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28660 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
28661 int64_t ret_ref = (uintptr_t)ret_copy;
28665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
28666 LDKStaticPaymentOutputDescriptor a_conv;
28667 a_conv.inner = (void*)(a & (~1));
28668 a_conv.is_owned = (a & 1) || (a == 0);
28669 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28670 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
28671 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
28672 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
28673 int64_t ret_ref = (uintptr_t)ret_copy;
28677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28678 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
28679 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
28680 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28681 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28682 CVec_u8Z_free(ret_var);
28686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28687 LDKu8slice ser_ref;
28688 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28689 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28690 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
28691 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
28692 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28693 return (int64_t)ret_conv;
28696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28697 if ((this_ptr & 1) != 0) return;
28698 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28699 CHECK_ACCESS(this_ptr_ptr);
28700 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
28701 FREE((void*)this_ptr);
28702 BaseSign_free(this_ptr_conv);
28705 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
28706 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28707 *ret_ret = Sign_clone(arg);
28708 return (int64_t)ret_ret;
28710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28711 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
28712 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28713 LDKSign* arg_conv = (LDKSign*)arg_ptr;
28714 int64_t ret_conv = Sign_clone_ptr(arg_conv);
28718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28719 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
28720 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28721 LDKSign* orig_conv = (LDKSign*)orig_ptr;
28722 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
28723 *ret_ret = Sign_clone(orig_conv);
28724 return (int64_t)ret_ret;
28727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28728 if ((this_ptr & 1) != 0) return;
28729 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28730 CHECK_ACCESS(this_ptr_ptr);
28731 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
28732 FREE((void*)this_ptr);
28733 Sign_free(this_ptr_conv);
28736 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28737 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
28738 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
28742 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
28743 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
28747 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
28748 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
28752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28753 if ((this_ptr & 1) != 0) return;
28754 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28755 CHECK_ACCESS(this_ptr_ptr);
28756 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
28757 FREE((void*)this_ptr);
28758 KeysInterface_free(this_ptr_conv);
28761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28762 LDKInMemorySigner this_obj_conv;
28763 this_obj_conv.inner = (void*)(this_obj & (~1));
28764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28766 InMemorySigner_free(this_obj_conv);
28769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28770 LDKInMemorySigner this_ptr_conv;
28771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28772 this_ptr_conv.is_owned = false;
28773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28774 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28775 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
28779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28780 LDKInMemorySigner this_ptr_conv;
28781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28782 this_ptr_conv.is_owned = false;
28783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28784 LDKSecretKey val_ref;
28785 CHECK((*env)->GetArrayLength(env, val) == 32);
28786 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28787 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
28790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28791 LDKInMemorySigner this_ptr_conv;
28792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28793 this_ptr_conv.is_owned = false;
28794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28795 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28796 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
28800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28801 LDKInMemorySigner this_ptr_conv;
28802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28803 this_ptr_conv.is_owned = false;
28804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28805 LDKSecretKey val_ref;
28806 CHECK((*env)->GetArrayLength(env, val) == 32);
28807 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28808 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
28811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28812 LDKInMemorySigner this_ptr_conv;
28813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28814 this_ptr_conv.is_owned = false;
28815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28816 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28817 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
28821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28822 LDKInMemorySigner this_ptr_conv;
28823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28824 this_ptr_conv.is_owned = false;
28825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28826 LDKSecretKey val_ref;
28827 CHECK((*env)->GetArrayLength(env, val) == 32);
28828 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28829 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
28832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28833 LDKInMemorySigner this_ptr_conv;
28834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28835 this_ptr_conv.is_owned = false;
28836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28837 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28838 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
28842 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) {
28843 LDKInMemorySigner this_ptr_conv;
28844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28845 this_ptr_conv.is_owned = false;
28846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28847 LDKSecretKey val_ref;
28848 CHECK((*env)->GetArrayLength(env, val) == 32);
28849 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28850 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
28853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
28854 LDKInMemorySigner this_ptr_conv;
28855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28856 this_ptr_conv.is_owned = false;
28857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28858 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28859 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
28863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28864 LDKInMemorySigner this_ptr_conv;
28865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28866 this_ptr_conv.is_owned = false;
28867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28868 LDKSecretKey val_ref;
28869 CHECK((*env)->GetArrayLength(env, val) == 32);
28870 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
28871 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
28874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
28875 LDKInMemorySigner this_ptr_conv;
28876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28877 this_ptr_conv.is_owned = false;
28878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28879 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28880 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
28884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28885 LDKInMemorySigner this_ptr_conv;
28886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28887 this_ptr_conv.is_owned = false;
28888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28889 LDKThirtyTwoBytes val_ref;
28890 CHECK((*env)->GetArrayLength(env, val) == 32);
28891 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28892 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
28895 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
28896 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
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) {
28907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28908 LDKInMemorySigner arg_conv;
28909 arg_conv.inner = (void*)(arg & (~1));
28910 arg_conv.is_owned = false;
28911 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28912 int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
28916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28917 LDKInMemorySigner orig_conv;
28918 orig_conv.inner = (void*)(orig & (~1));
28919 orig_conv.is_owned = false;
28920 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28921 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
28922 int64_t ret_ref = 0;
28923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28926 ret_ref = (uintptr_t)ret_var.inner;
28927 if (ret_var.is_owned) {
28933 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) {
28934 LDKSecretKey node_secret_ref;
28935 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
28936 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
28937 LDKSecretKey funding_key_ref;
28938 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
28939 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
28940 LDKSecretKey revocation_base_key_ref;
28941 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
28942 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
28943 LDKSecretKey payment_key_ref;
28944 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
28945 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
28946 LDKSecretKey delayed_payment_base_key_ref;
28947 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
28948 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
28949 LDKSecretKey htlc_base_key_ref;
28950 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
28951 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
28952 LDKThirtyTwoBytes commitment_seed_ref;
28953 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
28954 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
28955 LDKThirtyTwoBytes channel_keys_id_ref;
28956 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
28957 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
28958 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);
28959 int64_t ret_ref = 0;
28960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28963 ret_ref = (uintptr_t)ret_var.inner;
28964 if (ret_var.is_owned) {
28970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
28971 LDKInMemorySigner this_arg_conv;
28972 this_arg_conv.inner = (void*)(this_arg & (~1));
28973 this_arg_conv.is_owned = false;
28974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28975 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
28976 int64_t ret_ref = 0;
28977 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28978 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28980 ret_ref = (uintptr_t)ret_var.inner;
28981 if (ret_var.is_owned) {
28987 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28988 LDKInMemorySigner this_arg_conv;
28989 this_arg_conv.inner = (void*)(this_arg & (~1));
28990 this_arg_conv.is_owned = false;
28991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28992 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
28996 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28997 LDKInMemorySigner this_arg_conv;
28998 this_arg_conv.inner = (void*)(this_arg & (~1));
28999 this_arg_conv.is_owned = false;
29000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29001 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
29005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
29006 LDKInMemorySigner this_arg_conv;
29007 this_arg_conv.inner = (void*)(this_arg & (~1));
29008 this_arg_conv.is_owned = false;
29009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29010 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
29014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
29015 LDKInMemorySigner this_arg_conv;
29016 this_arg_conv.inner = (void*)(this_arg & (~1));
29017 this_arg_conv.is_owned = false;
29018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29019 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
29020 int64_t ret_ref = 0;
29021 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29022 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29024 ret_ref = (uintptr_t)ret_var.inner;
29025 if (ret_var.is_owned) {
29031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
29032 LDKInMemorySigner this_arg_conv;
29033 this_arg_conv.inner = (void*)(this_arg & (~1));
29034 this_arg_conv.is_owned = false;
29035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29036 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
29037 int64_t ret_ref = 0;
29038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29041 ret_ref = (uintptr_t)ret_var.inner;
29042 if (ret_var.is_owned) {
29048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
29049 LDKInMemorySigner this_arg_conv;
29050 this_arg_conv.inner = (void*)(this_arg & (~1));
29051 this_arg_conv.is_owned = false;
29052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29053 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
29057 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) {
29058 LDKInMemorySigner this_arg_conv;
29059 this_arg_conv.inner = (void*)(this_arg & (~1));
29060 this_arg_conv.is_owned = false;
29061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29062 LDKTransaction spend_tx_ref;
29063 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
29064 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
29065 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
29066 spend_tx_ref.data_is_owned = true;
29067 LDKStaticPaymentOutputDescriptor descriptor_conv;
29068 descriptor_conv.inner = (void*)(descriptor & (~1));
29069 descriptor_conv.is_owned = false;
29070 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
29071 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
29072 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
29073 return (int64_t)ret_conv;
29076 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) {
29077 LDKInMemorySigner this_arg_conv;
29078 this_arg_conv.inner = (void*)(this_arg & (~1));
29079 this_arg_conv.is_owned = false;
29080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29081 LDKTransaction spend_tx_ref;
29082 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
29083 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
29084 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
29085 spend_tx_ref.data_is_owned = true;
29086 LDKDelayedPaymentOutputDescriptor descriptor_conv;
29087 descriptor_conv.inner = (void*)(descriptor & (~1));
29088 descriptor_conv.is_owned = false;
29089 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
29090 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
29091 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
29092 return (int64_t)ret_conv;
29095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
29096 LDKInMemorySigner 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 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
29101 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
29102 return (int64_t)ret_ret;
29105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
29106 LDKInMemorySigner this_arg_conv;
29107 this_arg_conv.inner = (void*)(this_arg & (~1));
29108 this_arg_conv.is_owned = false;
29109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29110 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
29111 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
29112 return (int64_t)ret_ret;
29115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
29116 LDKInMemorySigner obj_conv;
29117 obj_conv.inner = (void*)(obj & (~1));
29118 obj_conv.is_owned = false;
29119 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29120 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
29121 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29122 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29123 CVec_u8Z_free(ret_var);
29127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
29128 LDKu8slice ser_ref;
29129 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29130 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29131 LDKSecretKey arg_ref;
29132 CHECK((*env)->GetArrayLength(env, arg) == 32);
29133 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
29134 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
29135 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
29136 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29137 return (int64_t)ret_conv;
29140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29141 LDKKeysManager this_obj_conv;
29142 this_obj_conv.inner = (void*)(this_obj & (~1));
29143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29145 KeysManager_free(this_obj_conv);
29148 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) {
29149 unsigned char seed_arr[32];
29150 CHECK((*env)->GetArrayLength(env, seed) == 32);
29151 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
29152 unsigned char (*seed_ref)[32] = &seed_arr;
29153 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
29154 int64_t ret_ref = 0;
29155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29158 ret_ref = (uintptr_t)ret_var.inner;
29159 if (ret_var.is_owned) {
29165 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) {
29166 LDKKeysManager this_arg_conv;
29167 this_arg_conv.inner = (void*)(this_arg & (~1));
29168 this_arg_conv.is_owned = false;
29169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29170 unsigned char params_arr[32];
29171 CHECK((*env)->GetArrayLength(env, params) == 32);
29172 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
29173 unsigned char (*params_ref)[32] = ¶ms_arr;
29174 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
29175 int64_t ret_ref = 0;
29176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29179 ret_ref = (uintptr_t)ret_var.inner;
29180 if (ret_var.is_owned) {
29186 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) {
29187 LDKKeysManager this_arg_conv;
29188 this_arg_conv.inner = (void*)(this_arg & (~1));
29189 this_arg_conv.is_owned = false;
29190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29191 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
29192 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
29193 if (descriptors_constr.datalen > 0)
29194 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
29196 descriptors_constr.data = NULL;
29197 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
29198 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
29199 int64_t descriptors_conv_27 = descriptors_vals[b];
29200 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
29201 CHECK_ACCESS(descriptors_conv_27_ptr);
29202 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
29203 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
29204 descriptors_constr.data[b] = descriptors_conv_27_conv;
29206 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
29207 LDKCVec_TxOutZ outputs_constr;
29208 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
29209 if (outputs_constr.datalen > 0)
29210 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
29212 outputs_constr.data = NULL;
29213 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
29214 for (size_t h = 0; h < outputs_constr.datalen; h++) {
29215 int64_t outputs_conv_7 = outputs_vals[h];
29216 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
29217 CHECK_ACCESS(outputs_conv_7_ptr);
29218 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
29219 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
29220 outputs_constr.data[h] = outputs_conv_7_conv;
29222 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
29223 LDKCVec_u8Z change_destination_script_ref;
29224 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
29225 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
29226 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
29227 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
29228 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
29229 return (int64_t)ret_conv;
29232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
29233 LDKKeysManager 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 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
29238 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
29239 return (int64_t)ret_ret;
29242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29243 LDKPhantomKeysManager this_obj_conv;
29244 this_obj_conv.inner = (void*)(this_obj & (~1));
29245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29247 PhantomKeysManager_free(this_obj_conv);
29250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
29251 LDKPhantomKeysManager this_arg_conv;
29252 this_arg_conv.inner = (void*)(this_arg & (~1));
29253 this_arg_conv.is_owned = false;
29254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29255 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
29256 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
29257 return (int64_t)ret_ret;
29260 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) {
29261 unsigned char seed_arr[32];
29262 CHECK((*env)->GetArrayLength(env, seed) == 32);
29263 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
29264 unsigned char (*seed_ref)[32] = &seed_arr;
29265 unsigned char cross_node_seed_arr[32];
29266 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
29267 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
29268 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
29269 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
29270 int64_t ret_ref = 0;
29271 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29272 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29274 ret_ref = (uintptr_t)ret_var.inner;
29275 if (ret_var.is_owned) {
29281 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) {
29282 LDKPhantomKeysManager 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 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
29287 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
29288 if (descriptors_constr.datalen > 0)
29289 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
29291 descriptors_constr.data = NULL;
29292 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
29293 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
29294 int64_t descriptors_conv_27 = descriptors_vals[b];
29295 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
29296 CHECK_ACCESS(descriptors_conv_27_ptr);
29297 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
29298 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
29299 descriptors_constr.data[b] = descriptors_conv_27_conv;
29301 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
29302 LDKCVec_TxOutZ outputs_constr;
29303 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
29304 if (outputs_constr.datalen > 0)
29305 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
29307 outputs_constr.data = NULL;
29308 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
29309 for (size_t h = 0; h < outputs_constr.datalen; h++) {
29310 int64_t outputs_conv_7 = outputs_vals[h];
29311 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
29312 CHECK_ACCESS(outputs_conv_7_ptr);
29313 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
29314 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
29315 outputs_constr.data[h] = outputs_conv_7_conv;
29317 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
29318 LDKCVec_u8Z change_destination_script_ref;
29319 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
29320 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
29321 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
29322 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
29323 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
29324 return (int64_t)ret_conv;
29327 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) {
29328 LDKPhantomKeysManager this_arg_conv;
29329 this_arg_conv.inner = (void*)(this_arg & (~1));
29330 this_arg_conv.is_owned = false;
29331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29332 unsigned char params_arr[32];
29333 CHECK((*env)->GetArrayLength(env, params) == 32);
29334 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
29335 unsigned char (*params_ref)[32] = ¶ms_arr;
29336 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
29337 int64_t ret_ref = 0;
29338 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29339 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29341 ret_ref = (uintptr_t)ret_var.inner;
29342 if (ret_var.is_owned) {
29348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29349 LDKChannelManager this_obj_conv;
29350 this_obj_conv.inner = (void*)(this_obj & (~1));
29351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29353 ChannelManager_free(this_obj_conv);
29356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29357 LDKChainParameters this_obj_conv;
29358 this_obj_conv.inner = (void*)(this_obj & (~1));
29359 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29361 ChainParameters_free(this_obj_conv);
29364 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
29365 LDKChainParameters this_ptr_conv;
29366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29367 this_ptr_conv.is_owned = false;
29368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29369 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
29373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
29374 LDKChainParameters this_ptr_conv;
29375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29376 this_ptr_conv.is_owned = false;
29377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29378 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
29379 ChainParameters_set_network(&this_ptr_conv, val_conv);
29382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
29383 LDKChainParameters this_ptr_conv;
29384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29385 this_ptr_conv.is_owned = false;
29386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29387 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
29388 int64_t ret_ref = 0;
29389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29392 ret_ref = (uintptr_t)ret_var.inner;
29393 if (ret_var.is_owned) {
29399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29400 LDKChainParameters this_ptr_conv;
29401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29402 this_ptr_conv.is_owned = false;
29403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29404 LDKBestBlock val_conv;
29405 val_conv.inner = (void*)(val & (~1));
29406 val_conv.is_owned = (val & 1) || (val == 0);
29407 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29408 val_conv = BestBlock_clone(&val_conv);
29409 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
29412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
29413 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
29414 LDKBestBlock best_block_arg_conv;
29415 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
29416 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
29417 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
29418 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
29419 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
29420 int64_t ret_ref = 0;
29421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29424 ret_ref = (uintptr_t)ret_var.inner;
29425 if (ret_var.is_owned) {
29431 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
29432 LDKChainParameters ret_var = ChainParameters_clone(arg);
29433 int64_t ret_ref = 0;
29434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29437 ret_ref = (uintptr_t)ret_var.inner;
29438 if (ret_var.is_owned) {
29443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29444 LDKChainParameters arg_conv;
29445 arg_conv.inner = (void*)(arg & (~1));
29446 arg_conv.is_owned = false;
29447 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29448 int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
29452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29453 LDKChainParameters orig_conv;
29454 orig_conv.inner = (void*)(orig & (~1));
29455 orig_conv.is_owned = false;
29456 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29457 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
29458 int64_t ret_ref = 0;
29459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29462 ret_ref = (uintptr_t)ret_var.inner;
29463 if (ret_var.is_owned) {
29469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29470 LDKCounterpartyForwardingInfo this_obj_conv;
29471 this_obj_conv.inner = (void*)(this_obj & (~1));
29472 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29474 CounterpartyForwardingInfo_free(this_obj_conv);
29477 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29478 LDKCounterpartyForwardingInfo this_ptr_conv;
29479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29480 this_ptr_conv.is_owned = false;
29481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29482 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
29486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29487 LDKCounterpartyForwardingInfo this_ptr_conv;
29488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29489 this_ptr_conv.is_owned = false;
29490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29491 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
29494 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
29495 LDKCounterpartyForwardingInfo this_ptr_conv;
29496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29497 this_ptr_conv.is_owned = false;
29498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29499 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
29503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29504 LDKCounterpartyForwardingInfo this_ptr_conv;
29505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29506 this_ptr_conv.is_owned = false;
29507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29508 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
29511 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
29512 LDKCounterpartyForwardingInfo this_ptr_conv;
29513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29514 this_ptr_conv.is_owned = false;
29515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29516 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
29520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29521 LDKCounterpartyForwardingInfo this_ptr_conv;
29522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29523 this_ptr_conv.is_owned = false;
29524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29525 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
29528 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) {
29529 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
29530 int64_t ret_ref = 0;
29531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29534 ret_ref = (uintptr_t)ret_var.inner;
29535 if (ret_var.is_owned) {
29541 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
29542 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
29543 int64_t ret_ref = 0;
29544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29547 ret_ref = (uintptr_t)ret_var.inner;
29548 if (ret_var.is_owned) {
29553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29554 LDKCounterpartyForwardingInfo arg_conv;
29555 arg_conv.inner = (void*)(arg & (~1));
29556 arg_conv.is_owned = false;
29557 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29558 int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
29562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29563 LDKCounterpartyForwardingInfo orig_conv;
29564 orig_conv.inner = (void*)(orig & (~1));
29565 orig_conv.is_owned = false;
29566 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29567 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
29568 int64_t ret_ref = 0;
29569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29572 ret_ref = (uintptr_t)ret_var.inner;
29573 if (ret_var.is_owned) {
29579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29580 LDKChannelCounterparty this_obj_conv;
29581 this_obj_conv.inner = (void*)(this_obj & (~1));
29582 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29584 ChannelCounterparty_free(this_obj_conv);
29587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29588 LDKChannelCounterparty 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29593 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
29597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29598 LDKChannelCounterparty this_ptr_conv;
29599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29600 this_ptr_conv.is_owned = false;
29601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29602 LDKPublicKey val_ref;
29603 CHECK((*env)->GetArrayLength(env, val) == 33);
29604 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29605 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
29608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29609 LDKChannelCounterparty this_ptr_conv;
29610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29611 this_ptr_conv.is_owned = false;
29612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29613 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
29614 int64_t ret_ref = 0;
29615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29618 ret_ref = (uintptr_t)ret_var.inner;
29619 if (ret_var.is_owned) {
29625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29626 LDKChannelCounterparty this_ptr_conv;
29627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29628 this_ptr_conv.is_owned = false;
29629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29630 LDKInitFeatures val_conv;
29631 val_conv.inner = (void*)(val & (~1));
29632 val_conv.is_owned = (val & 1) || (val == 0);
29633 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29634 val_conv = InitFeatures_clone(&val_conv);
29635 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
29638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
29639 LDKChannelCounterparty this_ptr_conv;
29640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29641 this_ptr_conv.is_owned = false;
29642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29643 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
29647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29648 LDKChannelCounterparty this_ptr_conv;
29649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29650 this_ptr_conv.is_owned = false;
29651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29652 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
29655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
29656 LDKChannelCounterparty this_ptr_conv;
29657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29658 this_ptr_conv.is_owned = false;
29659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29660 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
29661 int64_t ret_ref = 0;
29662 if ((uintptr_t)ret_var.inner > 4096) {
29663 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29664 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29666 ret_ref = (uintptr_t)ret_var.inner;
29667 if (ret_var.is_owned) {
29674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29675 LDKChannelCounterparty this_ptr_conv;
29676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29677 this_ptr_conv.is_owned = false;
29678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29679 LDKCounterpartyForwardingInfo val_conv;
29680 val_conv.inner = (void*)(val & (~1));
29681 val_conv.is_owned = (val & 1) || (val == 0);
29682 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29683 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
29684 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
29687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29688 LDKChannelCounterparty 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 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29693 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
29694 int64_t ret_ref = (uintptr_t)ret_copy;
29698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29699 LDKChannelCounterparty this_ptr_conv;
29700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29701 this_ptr_conv.is_owned = false;
29702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29703 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29704 CHECK_ACCESS(val_ptr);
29705 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29706 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29707 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
29710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29711 LDKChannelCounterparty this_ptr_conv;
29712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29713 this_ptr_conv.is_owned = false;
29714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29715 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29716 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
29717 int64_t ret_ref = (uintptr_t)ret_copy;
29721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29722 LDKChannelCounterparty this_ptr_conv;
29723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29724 this_ptr_conv.is_owned = false;
29725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29726 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29727 CHECK_ACCESS(val_ptr);
29728 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29729 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29730 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
29733 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, int64_t outbound_htlc_minimum_msat_arg, int64_t outbound_htlc_maximum_msat_arg) {
29734 LDKPublicKey node_id_arg_ref;
29735 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
29736 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
29737 LDKInitFeatures features_arg_conv;
29738 features_arg_conv.inner = (void*)(features_arg & (~1));
29739 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
29740 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29741 features_arg_conv = InitFeatures_clone(&features_arg_conv);
29742 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
29743 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
29744 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
29745 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
29746 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
29747 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
29748 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
29749 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
29750 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
29751 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
29752 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
29753 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
29754 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
29755 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv, outbound_htlc_minimum_msat_arg_conv, outbound_htlc_maximum_msat_arg_conv);
29756 int64_t ret_ref = 0;
29757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29760 ret_ref = (uintptr_t)ret_var.inner;
29761 if (ret_var.is_owned) {
29767 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
29768 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
29769 int64_t ret_ref = 0;
29770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29773 ret_ref = (uintptr_t)ret_var.inner;
29774 if (ret_var.is_owned) {
29779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29780 LDKChannelCounterparty arg_conv;
29781 arg_conv.inner = (void*)(arg & (~1));
29782 arg_conv.is_owned = false;
29783 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29784 int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
29788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29789 LDKChannelCounterparty orig_conv;
29790 orig_conv.inner = (void*)(orig & (~1));
29791 orig_conv.is_owned = false;
29792 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29793 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
29794 int64_t ret_ref = 0;
29795 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29796 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29798 ret_ref = (uintptr_t)ret_var.inner;
29799 if (ret_var.is_owned) {
29805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29806 LDKChannelDetails this_obj_conv;
29807 this_obj_conv.inner = (void*)(this_obj & (~1));
29808 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29810 ChannelDetails_free(this_obj_conv);
29813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29814 LDKChannelDetails this_ptr_conv;
29815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29816 this_ptr_conv.is_owned = false;
29817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29818 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29819 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
29823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29824 LDKChannelDetails this_ptr_conv;
29825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29826 this_ptr_conv.is_owned = false;
29827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29828 LDKThirtyTwoBytes val_ref;
29829 CHECK((*env)->GetArrayLength(env, val) == 32);
29830 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29831 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
29834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
29835 LDKChannelDetails this_ptr_conv;
29836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29837 this_ptr_conv.is_owned = false;
29838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29839 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
29840 int64_t ret_ref = 0;
29841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29844 ret_ref = (uintptr_t)ret_var.inner;
29845 if (ret_var.is_owned) {
29851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29852 LDKChannelDetails this_ptr_conv;
29853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29854 this_ptr_conv.is_owned = false;
29855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29856 LDKChannelCounterparty val_conv;
29857 val_conv.inner = (void*)(val & (~1));
29858 val_conv.is_owned = (val & 1) || (val == 0);
29859 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29860 val_conv = ChannelCounterparty_clone(&val_conv);
29861 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
29864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
29865 LDKChannelDetails this_ptr_conv;
29866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29867 this_ptr_conv.is_owned = false;
29868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29869 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
29870 int64_t ret_ref = 0;
29871 if ((uintptr_t)ret_var.inner > 4096) {
29872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29875 ret_ref = (uintptr_t)ret_var.inner;
29876 if (ret_var.is_owned) {
29883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29884 LDKChannelDetails this_ptr_conv;
29885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29886 this_ptr_conv.is_owned = false;
29887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29888 LDKOutPoint val_conv;
29889 val_conv.inner = (void*)(val & (~1));
29890 val_conv.is_owned = (val & 1) || (val == 0);
29891 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29892 val_conv = OutPoint_clone(&val_conv);
29893 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
29896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
29897 LDKChannelDetails this_ptr_conv;
29898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29899 this_ptr_conv.is_owned = false;
29900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29901 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
29902 int64_t ret_ref = 0;
29903 if ((uintptr_t)ret_var.inner > 4096) {
29904 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29905 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29907 ret_ref = (uintptr_t)ret_var.inner;
29908 if (ret_var.is_owned) {
29915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29916 LDKChannelDetails this_ptr_conv;
29917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29918 this_ptr_conv.is_owned = false;
29919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29920 LDKChannelTypeFeatures val_conv;
29921 val_conv.inner = (void*)(val & (~1));
29922 val_conv.is_owned = (val & 1) || (val == 0);
29923 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29924 val_conv = ChannelTypeFeatures_clone(&val_conv);
29925 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
29928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29929 LDKChannelDetails this_ptr_conv;
29930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29931 this_ptr_conv.is_owned = false;
29932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29933 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29934 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
29935 int64_t ret_ref = (uintptr_t)ret_copy;
29939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29940 LDKChannelDetails this_ptr_conv;
29941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29942 this_ptr_conv.is_owned = false;
29943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29944 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29945 CHECK_ACCESS(val_ptr);
29946 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29947 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29948 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
29951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29952 LDKChannelDetails this_ptr_conv;
29953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29954 this_ptr_conv.is_owned = false;
29955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29956 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29957 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
29958 int64_t ret_ref = (uintptr_t)ret_copy;
29962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29963 LDKChannelDetails this_ptr_conv;
29964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29965 this_ptr_conv.is_owned = false;
29966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29967 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29968 CHECK_ACCESS(val_ptr);
29969 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29970 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29971 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
29974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
29975 LDKChannelDetails this_ptr_conv;
29976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29977 this_ptr_conv.is_owned = false;
29978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29979 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29980 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
29981 int64_t ret_ref = (uintptr_t)ret_copy;
29985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29986 LDKChannelDetails this_ptr_conv;
29987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29988 this_ptr_conv.is_owned = false;
29989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29990 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29991 CHECK_ACCESS(val_ptr);
29992 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29993 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29994 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
29997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29998 LDKChannelDetails this_ptr_conv;
29999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30000 this_ptr_conv.is_owned = false;
30001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30002 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
30006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30007 LDKChannelDetails this_ptr_conv;
30008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30009 this_ptr_conv.is_owned = false;
30010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30011 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
30014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
30015 LDKChannelDetails this_ptr_conv;
30016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30017 this_ptr_conv.is_owned = false;
30018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30019 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30020 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
30021 int64_t ret_ref = (uintptr_t)ret_copy;
30025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30026 LDKChannelDetails this_ptr_conv;
30027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30028 this_ptr_conv.is_owned = false;
30029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30030 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30031 CHECK_ACCESS(val_ptr);
30032 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30033 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
30034 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
30037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30038 LDKChannelDetails this_ptr_conv;
30039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30040 this_ptr_conv.is_owned = false;
30041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30042 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
30046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30047 LDKChannelDetails this_ptr_conv;
30048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30049 this_ptr_conv.is_owned = false;
30050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30051 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
30054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30055 LDKChannelDetails this_ptr_conv;
30056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30057 this_ptr_conv.is_owned = false;
30058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30059 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
30063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30064 LDKChannelDetails this_ptr_conv;
30065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30066 this_ptr_conv.is_owned = false;
30067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30068 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
30071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30072 LDKChannelDetails this_ptr_conv;
30073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30074 this_ptr_conv.is_owned = false;
30075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30076 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
30080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30081 LDKChannelDetails this_ptr_conv;
30082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30083 this_ptr_conv.is_owned = false;
30084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30085 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
30088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30089 LDKChannelDetails this_ptr_conv;
30090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30091 this_ptr_conv.is_owned = false;
30092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30093 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
30097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30098 LDKChannelDetails this_ptr_conv;
30099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30100 this_ptr_conv.is_owned = false;
30101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30102 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
30105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30106 LDKChannelDetails this_ptr_conv;
30107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30108 this_ptr_conv.is_owned = false;
30109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30110 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
30114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30115 LDKChannelDetails this_ptr_conv;
30116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30117 this_ptr_conv.is_owned = false;
30118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30119 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
30122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
30123 LDKChannelDetails this_ptr_conv;
30124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30125 this_ptr_conv.is_owned = false;
30126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30127 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
30128 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
30129 int64_t ret_ref = (uintptr_t)ret_copy;
30133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30134 LDKChannelDetails this_ptr_conv;
30135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30136 this_ptr_conv.is_owned = false;
30137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30138 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30139 CHECK_ACCESS(val_ptr);
30140 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
30141 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
30142 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
30145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30146 LDKChannelDetails this_ptr_conv;
30147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30148 this_ptr_conv.is_owned = false;
30149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30150 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
30151 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
30152 int64_t ret_ref = (uintptr_t)ret_copy;
30156 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) {
30157 LDKChannelDetails this_ptr_conv;
30158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30159 this_ptr_conv.is_owned = false;
30160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30161 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30162 CHECK_ACCESS(val_ptr);
30163 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
30164 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
30165 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
30168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
30169 LDKChannelDetails this_ptr_conv;
30170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30171 this_ptr_conv.is_owned = false;
30172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30173 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
30177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30178 LDKChannelDetails this_ptr_conv;
30179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30180 this_ptr_conv.is_owned = false;
30181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30182 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
30185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
30186 LDKChannelDetails this_ptr_conv;
30187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30188 this_ptr_conv.is_owned = false;
30189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30190 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
30194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30195 LDKChannelDetails this_ptr_conv;
30196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30197 this_ptr_conv.is_owned = false;
30198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30199 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
30202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
30203 LDKChannelDetails this_ptr_conv;
30204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30205 this_ptr_conv.is_owned = false;
30206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30207 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
30211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30212 LDKChannelDetails this_ptr_conv;
30213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30214 this_ptr_conv.is_owned = false;
30215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30216 ChannelDetails_set_is_usable(&this_ptr_conv, val);
30219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
30220 LDKChannelDetails this_ptr_conv;
30221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30222 this_ptr_conv.is_owned = false;
30223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30224 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
30228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30229 LDKChannelDetails this_ptr_conv;
30230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30231 this_ptr_conv.is_owned = false;
30232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30233 ChannelDetails_set_is_public(&this_ptr_conv, val);
30236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30237 LDKChannelDetails this_ptr_conv;
30238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30239 this_ptr_conv.is_owned = false;
30240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30241 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30242 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
30243 int64_t ret_ref = (uintptr_t)ret_copy;
30247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30248 LDKChannelDetails this_ptr_conv;
30249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30250 this_ptr_conv.is_owned = false;
30251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30252 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30253 CHECK_ACCESS(val_ptr);
30254 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30255 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
30256 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
30259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30260 LDKChannelDetails this_ptr_conv;
30261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30262 this_ptr_conv.is_owned = false;
30263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30264 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30265 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
30266 int64_t ret_ref = (uintptr_t)ret_copy;
30270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30271 LDKChannelDetails this_ptr_conv;
30272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30273 this_ptr_conv.is_owned = false;
30274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30275 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30276 CHECK_ACCESS(val_ptr);
30277 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30278 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
30279 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
30282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30283 LDKChannelDetails this_ptr_conv;
30284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30285 this_ptr_conv.is_owned = false;
30286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30287 LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
30288 int64_t ret_ref = 0;
30289 if ((uintptr_t)ret_var.inner > 4096) {
30290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30293 ret_ref = (uintptr_t)ret_var.inner;
30294 if (ret_var.is_owned) {
30301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30302 LDKChannelDetails this_ptr_conv;
30303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30304 this_ptr_conv.is_owned = false;
30305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30306 LDKChannelConfig val_conv;
30307 val_conv.inner = (void*)(val & (~1));
30308 val_conv.is_owned = (val & 1) || (val == 0);
30309 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30310 val_conv = ChannelConfig_clone(&val_conv);
30311 ChannelDetails_set_config(&this_ptr_conv, val_conv);
30314 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 outbound_scid_alias_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 next_outbound_htlc_limit_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_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
30315 LDKThirtyTwoBytes channel_id_arg_ref;
30316 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30317 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30318 LDKChannelCounterparty counterparty_arg_conv;
30319 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
30320 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
30321 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
30322 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
30323 LDKOutPoint funding_txo_arg_conv;
30324 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
30325 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
30326 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
30327 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
30328 LDKChannelTypeFeatures channel_type_arg_conv;
30329 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
30330 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
30331 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
30332 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
30333 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
30334 CHECK_ACCESS(short_channel_id_arg_ptr);
30335 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
30336 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
30337 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
30338 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
30339 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
30340 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
30341 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
30342 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
30343 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
30344 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
30345 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
30346 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
30347 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
30348 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
30349 CHECK_ACCESS(confirmations_required_arg_ptr);
30350 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
30351 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
30352 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
30353 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
30354 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
30355 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
30356 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
30357 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
30358 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
30359 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
30360 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
30361 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
30362 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
30363 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
30364 LDKChannelConfig config_arg_conv;
30365 config_arg_conv.inner = (void*)(config_arg & (~1));
30366 config_arg_conv.is_owned = (config_arg & 1) || (config_arg == 0);
30367 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
30368 config_arg_conv = ChannelConfig_clone(&config_arg_conv);
30369 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, outbound_scid_alias_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, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
30370 int64_t ret_ref = 0;
30371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30374 ret_ref = (uintptr_t)ret_var.inner;
30375 if (ret_var.is_owned) {
30381 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
30382 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
30383 int64_t ret_ref = 0;
30384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30387 ret_ref = (uintptr_t)ret_var.inner;
30388 if (ret_var.is_owned) {
30393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30394 LDKChannelDetails arg_conv;
30395 arg_conv.inner = (void*)(arg & (~1));
30396 arg_conv.is_owned = false;
30397 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30398 int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
30402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30403 LDKChannelDetails orig_conv;
30404 orig_conv.inner = (void*)(orig & (~1));
30405 orig_conv.is_owned = false;
30406 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30407 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
30408 int64_t ret_ref = 0;
30409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30412 ret_ref = (uintptr_t)ret_var.inner;
30413 if (ret_var.is_owned) {
30419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30420 LDKChannelDetails this_arg_conv;
30421 this_arg_conv.inner = (void*)(this_arg & (~1));
30422 this_arg_conv.is_owned = false;
30423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30424 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30425 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
30426 int64_t ret_ref = (uintptr_t)ret_copy;
30430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30431 LDKChannelDetails this_arg_conv;
30432 this_arg_conv.inner = (void*)(this_arg & (~1));
30433 this_arg_conv.is_owned = false;
30434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30435 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30436 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
30437 int64_t ret_ref = (uintptr_t)ret_copy;
30441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30442 if ((this_ptr & 1) != 0) return;
30443 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30444 CHECK_ACCESS(this_ptr_ptr);
30445 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
30446 FREE((void*)this_ptr);
30447 PaymentSendFailure_free(this_ptr_conv);
30450 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
30451 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30452 *ret_copy = PaymentSendFailure_clone(arg);
30453 int64_t ret_ref = (uintptr_t)ret_copy;
30456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30457 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
30458 int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
30462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30463 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
30464 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30465 *ret_copy = PaymentSendFailure_clone(orig_conv);
30466 int64_t ret_ref = (uintptr_t)ret_copy;
30470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
30471 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
30472 CHECK_ACCESS(a_ptr);
30473 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
30474 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
30475 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30476 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
30477 int64_t ret_ref = (uintptr_t)ret_copy;
30481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
30482 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
30483 a_constr.datalen = (*env)->GetArrayLength(env, a);
30484 if (a_constr.datalen > 0)
30485 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
30487 a_constr.data = NULL;
30488 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
30489 for (size_t w = 0; w < a_constr.datalen; w++) {
30490 int64_t a_conv_22 = a_vals[w];
30491 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
30492 CHECK_ACCESS(a_conv_22_ptr);
30493 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
30494 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
30495 a_constr.data[w] = a_conv_22_conv;
30497 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
30498 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30499 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
30500 int64_t ret_ref = (uintptr_t)ret_copy;
30504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
30505 LDKCVec_APIErrorZ a_constr;
30506 a_constr.datalen = (*env)->GetArrayLength(env, a);
30507 if (a_constr.datalen > 0)
30508 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
30510 a_constr.data = NULL;
30511 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
30512 for (size_t k = 0; k < a_constr.datalen; k++) {
30513 int64_t a_conv_10 = a_vals[k];
30514 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
30515 CHECK_ACCESS(a_conv_10_ptr);
30516 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
30517 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
30518 a_constr.data[k] = a_conv_10_conv;
30520 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
30521 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30522 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
30523 int64_t ret_ref = (uintptr_t)ret_copy;
30527 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) {
30528 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
30529 results_constr.datalen = (*env)->GetArrayLength(env, results);
30530 if (results_constr.datalen > 0)
30531 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
30533 results_constr.data = NULL;
30534 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
30535 for (size_t w = 0; w < results_constr.datalen; w++) {
30536 int64_t results_conv_22 = results_vals[w];
30537 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
30538 CHECK_ACCESS(results_conv_22_ptr);
30539 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
30540 results_constr.data[w] = results_conv_22_conv;
30542 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
30543 LDKRouteParameters failed_paths_retry_conv;
30544 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
30545 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
30546 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
30547 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
30548 LDKThirtyTwoBytes payment_id_ref;
30549 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
30550 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
30551 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30552 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
30553 int64_t ret_ref = (uintptr_t)ret_copy;
30557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30558 LDKPhantomRouteHints this_obj_conv;
30559 this_obj_conv.inner = (void*)(this_obj & (~1));
30560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30562 PhantomRouteHints_free(this_obj_conv);
30565 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
30566 LDKPhantomRouteHints this_ptr_conv;
30567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30568 this_ptr_conv.is_owned = false;
30569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30570 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
30571 int64_tArray ret_arr = NULL;
30572 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30573 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30574 for (size_t q = 0; q < ret_var.datalen; q++) {
30575 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30576 int64_t ret_conv_16_ref = 0;
30577 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30578 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30580 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30581 if (ret_conv_16_var.is_owned) {
30582 ret_conv_16_ref |= 1;
30584 ret_arr_ptr[q] = ret_conv_16_ref;
30586 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30587 FREE(ret_var.data);
30591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
30592 LDKPhantomRouteHints this_ptr_conv;
30593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30594 this_ptr_conv.is_owned = false;
30595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30596 LDKCVec_ChannelDetailsZ val_constr;
30597 val_constr.datalen = (*env)->GetArrayLength(env, val);
30598 if (val_constr.datalen > 0)
30599 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
30601 val_constr.data = NULL;
30602 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
30603 for (size_t q = 0; q < val_constr.datalen; q++) {
30604 int64_t val_conv_16 = val_vals[q];
30605 LDKChannelDetails val_conv_16_conv;
30606 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
30607 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
30608 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
30609 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
30610 val_constr.data[q] = val_conv_16_conv;
30612 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
30613 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
30616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
30617 LDKPhantomRouteHints this_ptr_conv;
30618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30619 this_ptr_conv.is_owned = false;
30620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30621 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
30625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30626 LDKPhantomRouteHints 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 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
30633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30634 LDKPhantomRouteHints this_ptr_conv;
30635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30636 this_ptr_conv.is_owned = false;
30637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30638 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30639 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
30643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30644 LDKPhantomRouteHints this_ptr_conv;
30645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30646 this_ptr_conv.is_owned = false;
30647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30648 LDKPublicKey val_ref;
30649 CHECK((*env)->GetArrayLength(env, val) == 33);
30650 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30651 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
30654 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) {
30655 LDKCVec_ChannelDetailsZ channels_arg_constr;
30656 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
30657 if (channels_arg_constr.datalen > 0)
30658 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
30660 channels_arg_constr.data = NULL;
30661 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
30662 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
30663 int64_t channels_arg_conv_16 = channels_arg_vals[q];
30664 LDKChannelDetails channels_arg_conv_16_conv;
30665 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
30666 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
30667 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
30668 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
30669 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
30671 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
30672 LDKPublicKey real_node_pubkey_arg_ref;
30673 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
30674 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
30675 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
30676 int64_t ret_ref = 0;
30677 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30678 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30680 ret_ref = (uintptr_t)ret_var.inner;
30681 if (ret_var.is_owned) {
30687 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
30688 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
30689 int64_t ret_ref = 0;
30690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30693 ret_ref = (uintptr_t)ret_var.inner;
30694 if (ret_var.is_owned) {
30699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30700 LDKPhantomRouteHints arg_conv;
30701 arg_conv.inner = (void*)(arg & (~1));
30702 arg_conv.is_owned = false;
30703 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30704 int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
30708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30709 LDKPhantomRouteHints orig_conv;
30710 orig_conv.inner = (void*)(orig & (~1));
30711 orig_conv.is_owned = false;
30712 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30713 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
30714 int64_t ret_ref = 0;
30715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30718 ret_ref = (uintptr_t)ret_var.inner;
30719 if (ret_var.is_owned) {
30725 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) {
30726 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
30727 CHECK_ACCESS(fee_est_ptr);
30728 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
30729 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
30730 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30731 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
30733 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
30734 CHECK_ACCESS(chain_monitor_ptr);
30735 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30736 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30737 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30738 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30740 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
30741 CHECK_ACCESS(tx_broadcaster_ptr);
30742 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30743 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30744 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30745 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30747 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
30748 CHECK_ACCESS(logger_ptr);
30749 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30750 if (logger_conv.free == LDKLogger_JCalls_free) {
30751 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30752 LDKLogger_JCalls_cloned(&logger_conv);
30754 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
30755 CHECK_ACCESS(keys_manager_ptr);
30756 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30757 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30758 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30759 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30761 LDKUserConfig config_conv;
30762 config_conv.inner = (void*)(config & (~1));
30763 config_conv.is_owned = (config & 1) || (config == 0);
30764 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
30765 config_conv = UserConfig_clone(&config_conv);
30766 LDKChainParameters params_conv;
30767 params_conv.inner = (void*)(params & (~1));
30768 params_conv.is_owned = (params & 1) || (params == 0);
30769 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
30770 params_conv = ChainParameters_clone(¶ms_conv);
30771 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
30772 int64_t ret_ref = 0;
30773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30776 ret_ref = (uintptr_t)ret_var.inner;
30777 if (ret_var.is_owned) {
30783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
30784 LDKChannelManager this_arg_conv;
30785 this_arg_conv.inner = (void*)(this_arg & (~1));
30786 this_arg_conv.is_owned = false;
30787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30788 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
30789 int64_t ret_ref = 0;
30790 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30791 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30793 ret_ref = (uintptr_t)ret_var.inner;
30794 if (ret_var.is_owned) {
30800 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) {
30801 LDKChannelManager this_arg_conv;
30802 this_arg_conv.inner = (void*)(this_arg & (~1));
30803 this_arg_conv.is_owned = false;
30804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30805 LDKPublicKey their_network_key_ref;
30806 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
30807 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
30808 LDKUserConfig override_config_conv;
30809 override_config_conv.inner = (void*)(override_config & (~1));
30810 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
30811 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
30812 override_config_conv = UserConfig_clone(&override_config_conv);
30813 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
30814 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
30815 return (int64_t)ret_conv;
30818 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
30819 LDKChannelManager this_arg_conv;
30820 this_arg_conv.inner = (void*)(this_arg & (~1));
30821 this_arg_conv.is_owned = false;
30822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30823 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
30824 int64_tArray ret_arr = NULL;
30825 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30826 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30827 for (size_t q = 0; q < ret_var.datalen; q++) {
30828 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30829 int64_t ret_conv_16_ref = 0;
30830 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30831 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30833 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30834 if (ret_conv_16_var.is_owned) {
30835 ret_conv_16_ref |= 1;
30837 ret_arr_ptr[q] = ret_conv_16_ref;
30839 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30840 FREE(ret_var.data);
30844 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
30845 LDKChannelManager this_arg_conv;
30846 this_arg_conv.inner = (void*)(this_arg & (~1));
30847 this_arg_conv.is_owned = false;
30848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30849 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
30850 int64_tArray ret_arr = NULL;
30851 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30852 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30853 for (size_t q = 0; q < ret_var.datalen; q++) {
30854 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
30855 int64_t ret_conv_16_ref = 0;
30856 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30857 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30859 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30860 if (ret_conv_16_var.is_owned) {
30861 ret_conv_16_ref |= 1;
30863 ret_arr_ptr[q] = ret_conv_16_ref;
30865 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30866 FREE(ret_var.data);
30870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
30871 LDKChannelManager this_arg_conv;
30872 this_arg_conv.inner = (void*)(this_arg & (~1));
30873 this_arg_conv.is_owned = false;
30874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30875 unsigned char channel_id_arr[32];
30876 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30877 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30878 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30879 LDKPublicKey counterparty_node_id_ref;
30880 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30881 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30882 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30883 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30884 return (int64_t)ret_conv;
30887 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, int8_tArray counterparty_node_id, int32_t target_feerate_sats_per_1000_weight) {
30888 LDKChannelManager this_arg_conv;
30889 this_arg_conv.inner = (void*)(this_arg & (~1));
30890 this_arg_conv.is_owned = false;
30891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30892 unsigned char channel_id_arr[32];
30893 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30894 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30895 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30896 LDKPublicKey counterparty_node_id_ref;
30897 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30898 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30899 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30900 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
30901 return (int64_t)ret_conv;
30904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
30905 LDKChannelManager this_arg_conv;
30906 this_arg_conv.inner = (void*)(this_arg & (~1));
30907 this_arg_conv.is_owned = false;
30908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30909 unsigned char channel_id_arr[32];
30910 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30911 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30912 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30913 LDKPublicKey counterparty_node_id_ref;
30914 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30915 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30916 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30917 *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30918 return (int64_t)ret_conv;
30921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
30922 LDKChannelManager this_arg_conv;
30923 this_arg_conv.inner = (void*)(this_arg & (~1));
30924 this_arg_conv.is_owned = false;
30925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30926 unsigned char channel_id_arr[32];
30927 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
30928 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
30929 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
30930 LDKPublicKey counterparty_node_id_ref;
30931 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
30932 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
30933 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30934 *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
30935 return (int64_t)ret_conv;
30938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
30939 LDKChannelManager this_arg_conv;
30940 this_arg_conv.inner = (void*)(this_arg & (~1));
30941 this_arg_conv.is_owned = false;
30942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30943 ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
30946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
30947 LDKChannelManager this_arg_conv;
30948 this_arg_conv.inner = (void*)(this_arg & (~1));
30949 this_arg_conv.is_owned = false;
30950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30951 ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
30954 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) {
30955 LDKChannelManager this_arg_conv;
30956 this_arg_conv.inner = (void*)(this_arg & (~1));
30957 this_arg_conv.is_owned = false;
30958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30959 LDKRoute route_conv;
30960 route_conv.inner = (void*)(route & (~1));
30961 route_conv.is_owned = false;
30962 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
30963 LDKThirtyTwoBytes payment_hash_ref;
30964 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30965 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30966 LDKThirtyTwoBytes payment_secret_ref;
30967 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
30968 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
30969 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
30970 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
30971 return (int64_t)ret_conv;
30974 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) {
30975 LDKChannelManager this_arg_conv;
30976 this_arg_conv.inner = (void*)(this_arg & (~1));
30977 this_arg_conv.is_owned = false;
30978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30979 LDKRoute route_conv;
30980 route_conv.inner = (void*)(route & (~1));
30981 route_conv.is_owned = false;
30982 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
30983 LDKThirtyTwoBytes payment_id_ref;
30984 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
30985 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
30986 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
30987 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
30988 return (int64_t)ret_conv;
30991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
30992 LDKChannelManager this_arg_conv;
30993 this_arg_conv.inner = (void*)(this_arg & (~1));
30994 this_arg_conv.is_owned = false;
30995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30996 LDKThirtyTwoBytes payment_id_ref;
30997 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
30998 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
30999 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
31002 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) {
31003 LDKChannelManager this_arg_conv;
31004 this_arg_conv.inner = (void*)(this_arg & (~1));
31005 this_arg_conv.is_owned = false;
31006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31007 LDKRoute route_conv;
31008 route_conv.inner = (void*)(route & (~1));
31009 route_conv.is_owned = false;
31010 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
31011 LDKThirtyTwoBytes payment_preimage_ref;
31012 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
31013 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
31014 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
31015 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
31016 return (int64_t)ret_conv;
31019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) {
31020 LDKChannelManager this_arg_conv;
31021 this_arg_conv.inner = (void*)(this_arg & (~1));
31022 this_arg_conv.is_owned = false;
31023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31024 LDKCVec_RouteHopZ hops_constr;
31025 hops_constr.datalen = (*env)->GetArrayLength(env, hops);
31026 if (hops_constr.datalen > 0)
31027 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
31029 hops_constr.data = NULL;
31030 int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
31031 for (size_t k = 0; k < hops_constr.datalen; k++) {
31032 int64_t hops_conv_10 = hops_vals[k];
31033 LDKRouteHop hops_conv_10_conv;
31034 hops_conv_10_conv.inner = (void*)(hops_conv_10 & (~1));
31035 hops_conv_10_conv.is_owned = (hops_conv_10 & 1) || (hops_conv_10 == 0);
31036 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
31037 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
31038 hops_constr.data[k] = hops_conv_10_conv;
31040 (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
31041 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
31042 *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
31043 return (int64_t)ret_conv;
31046 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 counterparty_node_id, int8_tArray funding_transaction) {
31047 LDKChannelManager this_arg_conv;
31048 this_arg_conv.inner = (void*)(this_arg & (~1));
31049 this_arg_conv.is_owned = false;
31050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31051 unsigned char temporary_channel_id_arr[32];
31052 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31053 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31054 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31055 LDKPublicKey counterparty_node_id_ref;
31056 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31057 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31058 LDKTransaction funding_transaction_ref;
31059 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
31060 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
31061 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
31062 funding_transaction_ref.data_is_owned = true;
31063 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31064 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
31065 return (int64_t)ret_conv;
31068 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) {
31069 LDKChannelManager this_arg_conv;
31070 this_arg_conv.inner = (void*)(this_arg & (~1));
31071 this_arg_conv.is_owned = false;
31072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31073 LDKThreeBytes rgb_ref;
31074 CHECK((*env)->GetArrayLength(env, rgb) == 3);
31075 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
31076 LDKThirtyTwoBytes alias_ref;
31077 CHECK((*env)->GetArrayLength(env, alias) == 32);
31078 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
31079 LDKCVec_NetAddressZ addresses_constr;
31080 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
31081 if (addresses_constr.datalen > 0)
31082 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
31084 addresses_constr.data = NULL;
31085 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
31086 for (size_t m = 0; m < addresses_constr.datalen; m++) {
31087 int64_t addresses_conv_12 = addresses_vals[m];
31088 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
31089 CHECK_ACCESS(addresses_conv_12_ptr);
31090 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
31091 addresses_constr.data[m] = addresses_conv_12_conv;
31093 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
31094 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
31097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config) {
31098 LDKChannelManager this_arg_conv;
31099 this_arg_conv.inner = (void*)(this_arg & (~1));
31100 this_arg_conv.is_owned = false;
31101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31102 LDKPublicKey counterparty_node_id_ref;
31103 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31104 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31105 LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
31106 channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
31107 if (channel_ids_constr.datalen > 0)
31108 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
31110 channel_ids_constr.data = NULL;
31111 for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
31112 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
31113 LDKThirtyTwoBytes channel_ids_conv_8_ref;
31114 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
31115 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
31116 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
31118 LDKChannelConfig config_conv;
31119 config_conv.inner = (void*)(config & (~1));
31120 config_conv.is_owned = false;
31121 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
31122 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31123 *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
31124 return (int64_t)ret_conv;
31127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
31128 LDKChannelManager this_arg_conv;
31129 this_arg_conv.inner = (void*)(this_arg & (~1));
31130 this_arg_conv.is_owned = false;
31131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31132 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
31135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
31136 LDKChannelManager this_arg_conv;
31137 this_arg_conv.inner = (void*)(this_arg & (~1));
31138 this_arg_conv.is_owned = false;
31139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31140 ChannelManager_timer_tick_occurred(&this_arg_conv);
31143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
31144 LDKChannelManager this_arg_conv;
31145 this_arg_conv.inner = (void*)(this_arg & (~1));
31146 this_arg_conv.is_owned = false;
31147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31148 unsigned char payment_hash_arr[32];
31149 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31150 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
31151 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
31152 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
31155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
31156 LDKChannelManager this_arg_conv;
31157 this_arg_conv.inner = (void*)(this_arg & (~1));
31158 this_arg_conv.is_owned = false;
31159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31160 LDKThirtyTwoBytes payment_preimage_ref;
31161 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
31162 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
31163 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
31166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
31167 LDKChannelManager this_arg_conv;
31168 this_arg_conv.inner = (void*)(this_arg & (~1));
31169 this_arg_conv.is_owned = false;
31170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31171 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31172 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
31176 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, int8_tArray counterparty_node_id, int64_t user_channel_id) {
31177 LDKChannelManager this_arg_conv;
31178 this_arg_conv.inner = (void*)(this_arg & (~1));
31179 this_arg_conv.is_owned = false;
31180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31181 unsigned char temporary_channel_id_arr[32];
31182 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31183 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31184 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31185 LDKPublicKey counterparty_node_id_ref;
31186 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31187 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31188 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31189 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
31190 return (int64_t)ret_conv;
31193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) {
31194 LDKChannelManager this_arg_conv;
31195 this_arg_conv.inner = (void*)(this_arg & (~1));
31196 this_arg_conv.is_owned = false;
31197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31198 unsigned char temporary_channel_id_arr[32];
31199 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31200 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31201 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31202 LDKPublicKey counterparty_node_id_ref;
31203 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31204 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31205 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31206 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
31207 return (int64_t)ret_conv;
31210 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) {
31211 LDKChannelManager this_arg_conv;
31212 this_arg_conv.inner = (void*)(this_arg & (~1));
31213 this_arg_conv.is_owned = false;
31214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31215 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31216 CHECK_ACCESS(min_value_msat_ptr);
31217 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31218 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31219 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
31220 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
31221 return (int64_t)ret_conv;
31224 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) {
31225 LDKChannelManager this_arg_conv;
31226 this_arg_conv.inner = (void*)(this_arg & (~1));
31227 this_arg_conv.is_owned = false;
31228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31229 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31230 CHECK_ACCESS(min_value_msat_ptr);
31231 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31232 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31233 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
31234 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
31235 return (int64_t)ret_conv;
31238 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) {
31239 LDKChannelManager this_arg_conv;
31240 this_arg_conv.inner = (void*)(this_arg & (~1));
31241 this_arg_conv.is_owned = false;
31242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31243 LDKThirtyTwoBytes payment_hash_ref;
31244 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31245 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31246 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31247 CHECK_ACCESS(min_value_msat_ptr);
31248 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31249 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31250 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
31251 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
31252 return (int64_t)ret_conv;
31255 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) {
31256 LDKChannelManager this_arg_conv;
31257 this_arg_conv.inner = (void*)(this_arg & (~1));
31258 this_arg_conv.is_owned = false;
31259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31260 LDKThirtyTwoBytes payment_hash_ref;
31261 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31262 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31263 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31264 CHECK_ACCESS(min_value_msat_ptr);
31265 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31266 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31267 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
31268 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
31269 return (int64_t)ret_conv;
31272 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) {
31273 LDKChannelManager this_arg_conv;
31274 this_arg_conv.inner = (void*)(this_arg & (~1));
31275 this_arg_conv.is_owned = false;
31276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31277 LDKThirtyTwoBytes payment_hash_ref;
31278 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31279 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31280 LDKThirtyTwoBytes payment_secret_ref;
31281 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
31282 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
31283 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
31284 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
31285 return (int64_t)ret_conv;
31288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
31289 LDKChannelManager this_arg_conv;
31290 this_arg_conv.inner = (void*)(this_arg & (~1));
31291 this_arg_conv.is_owned = false;
31292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31293 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
31297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
31298 LDKChannelManager this_arg_conv;
31299 this_arg_conv.inner = (void*)(this_arg & (~1));
31300 this_arg_conv.is_owned = false;
31301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31302 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
31303 int64_t ret_ref = 0;
31304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31307 ret_ref = (uintptr_t)ret_var.inner;
31308 if (ret_var.is_owned) {
31314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31315 LDKChannelManager this_arg_conv;
31316 this_arg_conv.inner = (void*)(this_arg & (~1));
31317 this_arg_conv.is_owned = false;
31318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31319 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31320 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
31321 return (int64_t)ret_ret;
31324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31325 LDKChannelManager this_arg_conv;
31326 this_arg_conv.inner = (void*)(this_arg & (~1));
31327 this_arg_conv.is_owned = false;
31328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31329 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
31330 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
31331 return (int64_t)ret_ret;
31334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
31335 LDKChannelManager this_arg_conv;
31336 this_arg_conv.inner = (void*)(this_arg & (~1));
31337 this_arg_conv.is_owned = false;
31338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31339 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
31340 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
31341 return (int64_t)ret_ret;
31344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
31345 LDKChannelManager this_arg_conv;
31346 this_arg_conv.inner = (void*)(this_arg & (~1));
31347 this_arg_conv.is_owned = false;
31348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31349 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
31350 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
31351 return (int64_t)ret_ret;
31354 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) {
31355 LDKChannelManager this_arg_conv;
31356 this_arg_conv.inner = (void*)(this_arg & (~1));
31357 this_arg_conv.is_owned = false;
31358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31359 jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
31363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
31364 LDKChannelManager this_arg_conv;
31365 this_arg_conv.inner = (void*)(this_arg & (~1));
31366 this_arg_conv.is_owned = false;
31367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31368 ChannelManager_await_persistable_update(&this_arg_conv);
31371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
31372 LDKChannelManager this_arg_conv;
31373 this_arg_conv.inner = (void*)(this_arg & (~1));
31374 this_arg_conv.is_owned = false;
31375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31376 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
31377 int64_t ret_ref = 0;
31378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31381 ret_ref = (uintptr_t)ret_var.inner;
31382 if (ret_var.is_owned) {
31388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
31389 LDKChannelManager this_arg_conv;
31390 this_arg_conv.inner = (void*)(this_arg & (~1));
31391 this_arg_conv.is_owned = false;
31392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31393 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
31394 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
31395 return (int64_t)ret_ret;
31398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
31399 LDKCounterpartyForwardingInfo obj_conv;
31400 obj_conv.inner = (void*)(obj & (~1));
31401 obj_conv.is_owned = false;
31402 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31403 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
31404 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31405 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31406 CVec_u8Z_free(ret_var);
31410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31411 LDKu8slice ser_ref;
31412 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31413 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31414 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
31415 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
31416 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31417 return (int64_t)ret_conv;
31420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
31421 LDKChannelCounterparty obj_conv;
31422 obj_conv.inner = (void*)(obj & (~1));
31423 obj_conv.is_owned = false;
31424 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31425 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
31426 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31427 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31428 CVec_u8Z_free(ret_var);
31432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31433 LDKu8slice ser_ref;
31434 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31435 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31436 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
31437 *ret_conv = ChannelCounterparty_read(ser_ref);
31438 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31439 return (int64_t)ret_conv;
31442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
31443 LDKChannelDetails obj_conv;
31444 obj_conv.inner = (void*)(obj & (~1));
31445 obj_conv.is_owned = false;
31446 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31447 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
31448 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31449 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31450 CVec_u8Z_free(ret_var);
31454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31455 LDKu8slice ser_ref;
31456 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31457 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31458 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31459 *ret_conv = ChannelDetails_read(ser_ref);
31460 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31461 return (int64_t)ret_conv;
31464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
31465 LDKPhantomRouteHints obj_conv;
31466 obj_conv.inner = (void*)(obj & (~1));
31467 obj_conv.is_owned = false;
31468 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31469 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
31470 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31471 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31472 CVec_u8Z_free(ret_var);
31476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31477 LDKu8slice ser_ref;
31478 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31479 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31480 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
31481 *ret_conv = PhantomRouteHints_read(ser_ref);
31482 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31483 return (int64_t)ret_conv;
31486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
31487 LDKChannelManager obj_conv;
31488 obj_conv.inner = (void*)(obj & (~1));
31489 obj_conv.is_owned = false;
31490 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31491 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
31492 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31493 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31494 CVec_u8Z_free(ret_var);
31498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31499 LDKChannelManagerReadArgs this_obj_conv;
31500 this_obj_conv.inner = (void*)(this_obj & (~1));
31501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31503 ChannelManagerReadArgs_free(this_obj_conv);
31506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
31507 LDKChannelManagerReadArgs this_ptr_conv;
31508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31509 this_ptr_conv.is_owned = false;
31510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31511 // WARNING: This object doesn't live past this scope, needs clone!
31512 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
31516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31517 LDKChannelManagerReadArgs 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31522 CHECK_ACCESS(val_ptr);
31523 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
31524 if (val_conv.free == LDKKeysInterface_JCalls_free) {
31525 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31526 LDKKeysInterface_JCalls_cloned(&val_conv);
31528 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
31531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
31532 LDKChannelManagerReadArgs this_ptr_conv;
31533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31534 this_ptr_conv.is_owned = false;
31535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31536 // WARNING: This object doesn't live past this scope, needs clone!
31537 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
31541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31542 LDKChannelManagerReadArgs this_ptr_conv;
31543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31544 this_ptr_conv.is_owned = false;
31545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31546 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31547 CHECK_ACCESS(val_ptr);
31548 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
31549 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
31550 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31551 LDKFeeEstimator_JCalls_cloned(&val_conv);
31553 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
31556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
31557 LDKChannelManagerReadArgs this_ptr_conv;
31558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31559 this_ptr_conv.is_owned = false;
31560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31561 // WARNING: This object doesn't live past this scope, needs clone!
31562 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
31566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31567 LDKChannelManagerReadArgs this_ptr_conv;
31568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31569 this_ptr_conv.is_owned = false;
31570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31571 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31572 CHECK_ACCESS(val_ptr);
31573 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
31574 if (val_conv.free == LDKWatch_JCalls_free) {
31575 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31576 LDKWatch_JCalls_cloned(&val_conv);
31578 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
31581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
31582 LDKChannelManagerReadArgs this_ptr_conv;
31583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31584 this_ptr_conv.is_owned = false;
31585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31586 // WARNING: This object doesn't live past this scope, needs clone!
31587 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
31591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31592 LDKChannelManagerReadArgs this_ptr_conv;
31593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31594 this_ptr_conv.is_owned = false;
31595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31596 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31597 CHECK_ACCESS(val_ptr);
31598 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
31599 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
31600 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31601 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
31603 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
31606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
31607 LDKChannelManagerReadArgs this_ptr_conv;
31608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31609 this_ptr_conv.is_owned = false;
31610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31611 // WARNING: This object doesn't live past this scope, needs clone!
31612 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
31616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31617 LDKChannelManagerReadArgs this_ptr_conv;
31618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31619 this_ptr_conv.is_owned = false;
31620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31621 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31622 CHECK_ACCESS(val_ptr);
31623 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
31624 if (val_conv.free == LDKLogger_JCalls_free) {
31625 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31626 LDKLogger_JCalls_cloned(&val_conv);
31628 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
31631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
31632 LDKChannelManagerReadArgs this_ptr_conv;
31633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31634 this_ptr_conv.is_owned = false;
31635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31636 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
31637 int64_t ret_ref = 0;
31638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31641 ret_ref = (uintptr_t)ret_var.inner;
31642 if (ret_var.is_owned) {
31648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31649 LDKChannelManagerReadArgs this_ptr_conv;
31650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31651 this_ptr_conv.is_owned = false;
31652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31653 LDKUserConfig val_conv;
31654 val_conv.inner = (void*)(val & (~1));
31655 val_conv.is_owned = (val & 1) || (val == 0);
31656 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31657 val_conv = UserConfig_clone(&val_conv);
31658 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
31661 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) {
31662 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
31663 CHECK_ACCESS(keys_manager_ptr);
31664 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
31665 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
31666 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31667 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
31669 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
31670 CHECK_ACCESS(fee_estimator_ptr);
31671 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
31672 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
31673 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31674 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
31676 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
31677 CHECK_ACCESS(chain_monitor_ptr);
31678 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
31679 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
31680 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31681 LDKWatch_JCalls_cloned(&chain_monitor_conv);
31683 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
31684 CHECK_ACCESS(tx_broadcaster_ptr);
31685 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
31686 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
31687 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31688 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
31690 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
31691 CHECK_ACCESS(logger_ptr);
31692 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31693 if (logger_conv.free == LDKLogger_JCalls_free) {
31694 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31695 LDKLogger_JCalls_cloned(&logger_conv);
31697 LDKUserConfig default_config_conv;
31698 default_config_conv.inner = (void*)(default_config & (~1));
31699 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
31700 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
31701 default_config_conv = UserConfig_clone(&default_config_conv);
31702 LDKCVec_ChannelMonitorZ channel_monitors_constr;
31703 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
31704 if (channel_monitors_constr.datalen > 0)
31705 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
31707 channel_monitors_constr.data = NULL;
31708 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
31709 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
31710 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
31711 LDKChannelMonitor channel_monitors_conv_16_conv;
31712 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
31713 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
31714 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
31715 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
31717 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
31718 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);
31719 int64_t ret_ref = 0;
31720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31723 ret_ref = (uintptr_t)ret_var.inner;
31724 if (ret_var.is_owned) {
31730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
31731 LDKu8slice ser_ref;
31732 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31733 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31734 LDKChannelManagerReadArgs arg_conv;
31735 arg_conv.inner = (void*)(arg & (~1));
31736 arg_conv.is_owned = (arg & 1) || (arg == 0);
31737 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31738 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
31739 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
31740 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
31741 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31742 return (int64_t)ret_conv;
31745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31746 LDKExpandedKey this_obj_conv;
31747 this_obj_conv.inner = (void*)(this_obj & (~1));
31748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31750 ExpandedKey_free(this_obj_conv);
31753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
31754 unsigned char key_material_arr[32];
31755 CHECK((*env)->GetArrayLength(env, key_material) == 32);
31756 (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
31757 unsigned char (*key_material_ref)[32] = &key_material_arr;
31758 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
31759 int64_t ret_ref = 0;
31760 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31761 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31763 ret_ref = (uintptr_t)ret_var.inner;
31764 if (ret_var.is_owned) {
31770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t keys_manager, int64_t current_time) {
31771 LDKExpandedKey keys_conv;
31772 keys_conv.inner = (void*)(keys & (~1));
31773 keys_conv.is_owned = false;
31774 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
31775 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31776 CHECK_ACCESS(min_value_msat_ptr);
31777 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31778 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31779 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
31780 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
31781 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
31782 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
31783 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
31784 return (int64_t)ret_conv;
31787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time) {
31788 LDKExpandedKey keys_conv;
31789 keys_conv.inner = (void*)(keys & (~1));
31790 keys_conv.is_owned = false;
31791 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
31792 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
31793 CHECK_ACCESS(min_value_msat_ptr);
31794 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31795 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
31796 LDKThirtyTwoBytes payment_hash_ref;
31797 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31798 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31799 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
31800 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
31801 return (int64_t)ret_conv;
31804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31805 LDKDecodeError this_obj_conv;
31806 this_obj_conv.inner = (void*)(this_obj & (~1));
31807 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31809 DecodeError_free(this_obj_conv);
31812 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
31813 LDKDecodeError ret_var = DecodeError_clone(arg);
31814 int64_t ret_ref = 0;
31815 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31816 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31818 ret_ref = (uintptr_t)ret_var.inner;
31819 if (ret_var.is_owned) {
31824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31825 LDKDecodeError arg_conv;
31826 arg_conv.inner = (void*)(arg & (~1));
31827 arg_conv.is_owned = false;
31828 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31829 int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
31833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31834 LDKDecodeError orig_conv;
31835 orig_conv.inner = (void*)(orig & (~1));
31836 orig_conv.is_owned = false;
31837 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31838 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
31839 int64_t ret_ref = 0;
31840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31843 ret_ref = (uintptr_t)ret_var.inner;
31844 if (ret_var.is_owned) {
31850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31851 LDKInit this_obj_conv;
31852 this_obj_conv.inner = (void*)(this_obj & (~1));
31853 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31855 Init_free(this_obj_conv);
31858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
31859 LDKInit this_ptr_conv;
31860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31861 this_ptr_conv.is_owned = false;
31862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31863 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
31864 int64_t ret_ref = 0;
31865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31868 ret_ref = (uintptr_t)ret_var.inner;
31869 if (ret_var.is_owned) {
31875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31876 LDKInit this_ptr_conv;
31877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31878 this_ptr_conv.is_owned = false;
31879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31880 LDKInitFeatures val_conv;
31881 val_conv.inner = (void*)(val & (~1));
31882 val_conv.is_owned = (val & 1) || (val == 0);
31883 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31884 val_conv = InitFeatures_clone(&val_conv);
31885 Init_set_features(&this_ptr_conv, val_conv);
31888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
31889 LDKInit this_ptr_conv;
31890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31891 this_ptr_conv.is_owned = false;
31892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31893 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
31894 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
31895 int64_t ret_ref = (uintptr_t)ret_copy;
31899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31900 LDKInit this_ptr_conv;
31901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31902 this_ptr_conv.is_owned = false;
31903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31904 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31905 CHECK_ACCESS(val_ptr);
31906 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
31907 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
31908 Init_set_remote_network_address(&this_ptr_conv, val_conv);
31911 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) {
31912 LDKInitFeatures features_arg_conv;
31913 features_arg_conv.inner = (void*)(features_arg & (~1));
31914 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
31915 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
31916 features_arg_conv = InitFeatures_clone(&features_arg_conv);
31917 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
31918 CHECK_ACCESS(remote_network_address_arg_ptr);
31919 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
31920 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
31921 int64_t ret_ref = 0;
31922 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31923 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31925 ret_ref = (uintptr_t)ret_var.inner;
31926 if (ret_var.is_owned) {
31932 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
31933 LDKInit ret_var = Init_clone(arg);
31934 int64_t ret_ref = 0;
31935 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31936 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31938 ret_ref = (uintptr_t)ret_var.inner;
31939 if (ret_var.is_owned) {
31944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31946 arg_conv.inner = (void*)(arg & (~1));
31947 arg_conv.is_owned = false;
31948 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31949 int64_t ret_conv = Init_clone_ptr(&arg_conv);
31953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31955 orig_conv.inner = (void*)(orig & (~1));
31956 orig_conv.is_owned = false;
31957 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31958 LDKInit ret_var = Init_clone(&orig_conv);
31959 int64_t ret_ref = 0;
31960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31963 ret_ref = (uintptr_t)ret_var.inner;
31964 if (ret_var.is_owned) {
31970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31971 LDKErrorMessage this_obj_conv;
31972 this_obj_conv.inner = (void*)(this_obj & (~1));
31973 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31975 ErrorMessage_free(this_obj_conv);
31978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31979 LDKErrorMessage this_ptr_conv;
31980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31981 this_ptr_conv.is_owned = false;
31982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31983 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31984 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
31988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31989 LDKErrorMessage this_ptr_conv;
31990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31991 this_ptr_conv.is_owned = false;
31992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31993 LDKThirtyTwoBytes val_ref;
31994 CHECK((*env)->GetArrayLength(env, val) == 32);
31995 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31996 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
31999 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
32000 LDKErrorMessage this_ptr_conv;
32001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32002 this_ptr_conv.is_owned = false;
32003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32004 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
32005 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
32011 LDKErrorMessage this_ptr_conv;
32012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32013 this_ptr_conv.is_owned = false;
32014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32015 LDKStr val_conv = java_to_owned_str(env, val);
32016 ErrorMessage_set_data(&this_ptr_conv, val_conv);
32019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
32020 LDKThirtyTwoBytes channel_id_arg_ref;
32021 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32022 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32023 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
32024 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
32025 int64_t ret_ref = 0;
32026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32029 ret_ref = (uintptr_t)ret_var.inner;
32030 if (ret_var.is_owned) {
32036 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
32037 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
32038 int64_t ret_ref = 0;
32039 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32040 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32042 ret_ref = (uintptr_t)ret_var.inner;
32043 if (ret_var.is_owned) {
32048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32049 LDKErrorMessage arg_conv;
32050 arg_conv.inner = (void*)(arg & (~1));
32051 arg_conv.is_owned = false;
32052 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32053 int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
32057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32058 LDKErrorMessage orig_conv;
32059 orig_conv.inner = (void*)(orig & (~1));
32060 orig_conv.is_owned = false;
32061 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32062 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
32063 int64_t ret_ref = 0;
32064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32067 ret_ref = (uintptr_t)ret_var.inner;
32068 if (ret_var.is_owned) {
32074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32075 LDKWarningMessage this_obj_conv;
32076 this_obj_conv.inner = (void*)(this_obj & (~1));
32077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32079 WarningMessage_free(this_obj_conv);
32082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32083 LDKWarningMessage this_ptr_conv;
32084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32085 this_ptr_conv.is_owned = false;
32086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32087 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32088 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
32092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32093 LDKWarningMessage this_ptr_conv;
32094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32095 this_ptr_conv.is_owned = false;
32096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32097 LDKThirtyTwoBytes val_ref;
32098 CHECK((*env)->GetArrayLength(env, val) == 32);
32099 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32100 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
32103 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
32104 LDKWarningMessage this_ptr_conv;
32105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32106 this_ptr_conv.is_owned = false;
32107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32108 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
32109 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
32115 LDKWarningMessage this_ptr_conv;
32116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32117 this_ptr_conv.is_owned = false;
32118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32119 LDKStr val_conv = java_to_owned_str(env, val);
32120 WarningMessage_set_data(&this_ptr_conv, val_conv);
32123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
32124 LDKThirtyTwoBytes channel_id_arg_ref;
32125 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32126 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32127 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
32128 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
32129 int64_t ret_ref = 0;
32130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32133 ret_ref = (uintptr_t)ret_var.inner;
32134 if (ret_var.is_owned) {
32140 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
32141 LDKWarningMessage ret_var = WarningMessage_clone(arg);
32142 int64_t ret_ref = 0;
32143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32146 ret_ref = (uintptr_t)ret_var.inner;
32147 if (ret_var.is_owned) {
32152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32153 LDKWarningMessage arg_conv;
32154 arg_conv.inner = (void*)(arg & (~1));
32155 arg_conv.is_owned = false;
32156 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32157 int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
32161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32162 LDKWarningMessage orig_conv;
32163 orig_conv.inner = (void*)(orig & (~1));
32164 orig_conv.is_owned = false;
32165 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32166 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
32167 int64_t ret_ref = 0;
32168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32171 ret_ref = (uintptr_t)ret_var.inner;
32172 if (ret_var.is_owned) {
32178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32179 LDKPing this_obj_conv;
32180 this_obj_conv.inner = (void*)(this_obj & (~1));
32181 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32183 Ping_free(this_obj_conv);
32186 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32187 LDKPing this_ptr_conv;
32188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32189 this_ptr_conv.is_owned = false;
32190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32191 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
32195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32196 LDKPing this_ptr_conv;
32197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32198 this_ptr_conv.is_owned = false;
32199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32200 Ping_set_ponglen(&this_ptr_conv, val);
32203 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32204 LDKPing this_ptr_conv;
32205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32206 this_ptr_conv.is_owned = false;
32207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32208 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
32212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32213 LDKPing this_ptr_conv;
32214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32215 this_ptr_conv.is_owned = false;
32216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32217 Ping_set_byteslen(&this_ptr_conv, val);
32220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
32221 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
32222 int64_t ret_ref = 0;
32223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32226 ret_ref = (uintptr_t)ret_var.inner;
32227 if (ret_var.is_owned) {
32233 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
32234 LDKPing ret_var = Ping_clone(arg);
32235 int64_t ret_ref = 0;
32236 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32237 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32239 ret_ref = (uintptr_t)ret_var.inner;
32240 if (ret_var.is_owned) {
32245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32247 arg_conv.inner = (void*)(arg & (~1));
32248 arg_conv.is_owned = false;
32249 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32250 int64_t ret_conv = Ping_clone_ptr(&arg_conv);
32254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32256 orig_conv.inner = (void*)(orig & (~1));
32257 orig_conv.is_owned = false;
32258 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32259 LDKPing ret_var = Ping_clone(&orig_conv);
32260 int64_t ret_ref = 0;
32261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32264 ret_ref = (uintptr_t)ret_var.inner;
32265 if (ret_var.is_owned) {
32271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32272 LDKPong this_obj_conv;
32273 this_obj_conv.inner = (void*)(this_obj & (~1));
32274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32276 Pong_free(this_obj_conv);
32279 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32280 LDKPong this_ptr_conv;
32281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32282 this_ptr_conv.is_owned = false;
32283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32284 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
32288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32289 LDKPong this_ptr_conv;
32290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32291 this_ptr_conv.is_owned = false;
32292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32293 Pong_set_byteslen(&this_ptr_conv, val);
32296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
32297 LDKPong ret_var = Pong_new(byteslen_arg);
32298 int64_t ret_ref = 0;
32299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32302 ret_ref = (uintptr_t)ret_var.inner;
32303 if (ret_var.is_owned) {
32309 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
32310 LDKPong ret_var = Pong_clone(arg);
32311 int64_t ret_ref = 0;
32312 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32313 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32315 ret_ref = (uintptr_t)ret_var.inner;
32316 if (ret_var.is_owned) {
32321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32323 arg_conv.inner = (void*)(arg & (~1));
32324 arg_conv.is_owned = false;
32325 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32326 int64_t ret_conv = Pong_clone_ptr(&arg_conv);
32330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32332 orig_conv.inner = (void*)(orig & (~1));
32333 orig_conv.is_owned = false;
32334 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32335 LDKPong ret_var = Pong_clone(&orig_conv);
32336 int64_t ret_ref = 0;
32337 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32338 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32340 ret_ref = (uintptr_t)ret_var.inner;
32341 if (ret_var.is_owned) {
32347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32348 LDKOpenChannel this_obj_conv;
32349 this_obj_conv.inner = (void*)(this_obj & (~1));
32350 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32352 OpenChannel_free(this_obj_conv);
32355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32356 LDKOpenChannel this_ptr_conv;
32357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32358 this_ptr_conv.is_owned = false;
32359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32360 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32361 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
32365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32366 LDKOpenChannel this_ptr_conv;
32367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32368 this_ptr_conv.is_owned = false;
32369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32370 LDKThirtyTwoBytes val_ref;
32371 CHECK((*env)->GetArrayLength(env, val) == 32);
32372 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32373 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
32376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32377 LDKOpenChannel this_ptr_conv;
32378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32379 this_ptr_conv.is_owned = false;
32380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32381 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32382 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
32386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32387 LDKOpenChannel this_ptr_conv;
32388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32389 this_ptr_conv.is_owned = false;
32390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32391 LDKThirtyTwoBytes val_ref;
32392 CHECK((*env)->GetArrayLength(env, val) == 32);
32393 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32394 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
32397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32398 LDKOpenChannel this_ptr_conv;
32399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32400 this_ptr_conv.is_owned = false;
32401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32402 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
32406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32407 LDKOpenChannel this_ptr_conv;
32408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32409 this_ptr_conv.is_owned = false;
32410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32411 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
32414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32415 LDKOpenChannel this_ptr_conv;
32416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32417 this_ptr_conv.is_owned = false;
32418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32419 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
32423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32424 LDKOpenChannel this_ptr_conv;
32425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32426 this_ptr_conv.is_owned = false;
32427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32428 OpenChannel_set_push_msat(&this_ptr_conv, val);
32431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32432 LDKOpenChannel this_ptr_conv;
32433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32434 this_ptr_conv.is_owned = false;
32435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32436 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
32440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32441 LDKOpenChannel this_ptr_conv;
32442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32443 this_ptr_conv.is_owned = false;
32444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32445 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
32448 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) {
32449 LDKOpenChannel this_ptr_conv;
32450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32451 this_ptr_conv.is_owned = false;
32452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32453 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
32457 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) {
32458 LDKOpenChannel this_ptr_conv;
32459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32460 this_ptr_conv.is_owned = false;
32461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32462 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
32465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32466 LDKOpenChannel this_ptr_conv;
32467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32468 this_ptr_conv.is_owned = false;
32469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32470 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
32474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32475 LDKOpenChannel this_ptr_conv;
32476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32477 this_ptr_conv.is_owned = false;
32478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32479 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
32482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32483 LDKOpenChannel this_ptr_conv;
32484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32485 this_ptr_conv.is_owned = false;
32486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32487 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
32491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32492 LDKOpenChannel this_ptr_conv;
32493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32494 this_ptr_conv.is_owned = false;
32495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32496 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
32499 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
32500 LDKOpenChannel this_ptr_conv;
32501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32502 this_ptr_conv.is_owned = false;
32503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32504 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
32508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32509 LDKOpenChannel this_ptr_conv;
32510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32511 this_ptr_conv.is_owned = false;
32512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32513 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
32516 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
32517 LDKOpenChannel this_ptr_conv;
32518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32519 this_ptr_conv.is_owned = false;
32520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32521 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
32525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32526 LDKOpenChannel this_ptr_conv;
32527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32528 this_ptr_conv.is_owned = false;
32529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32530 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
32533 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32534 LDKOpenChannel this_ptr_conv;
32535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32536 this_ptr_conv.is_owned = false;
32537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32538 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
32542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32543 LDKOpenChannel this_ptr_conv;
32544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32545 this_ptr_conv.is_owned = false;
32546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32547 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
32550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32551 LDKOpenChannel this_ptr_conv;
32552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32553 this_ptr_conv.is_owned = false;
32554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32555 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32556 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
32560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32561 LDKOpenChannel this_ptr_conv;
32562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32563 this_ptr_conv.is_owned = false;
32564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32565 LDKPublicKey val_ref;
32566 CHECK((*env)->GetArrayLength(env, val) == 33);
32567 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32568 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
32571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32572 LDKOpenChannel this_ptr_conv;
32573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32574 this_ptr_conv.is_owned = false;
32575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32576 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32577 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
32581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32582 LDKOpenChannel this_ptr_conv;
32583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32584 this_ptr_conv.is_owned = false;
32585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32586 LDKPublicKey val_ref;
32587 CHECK((*env)->GetArrayLength(env, val) == 33);
32588 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32589 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
32592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32593 LDKOpenChannel this_ptr_conv;
32594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32595 this_ptr_conv.is_owned = false;
32596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32597 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32598 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
32602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32603 LDKOpenChannel this_ptr_conv;
32604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32605 this_ptr_conv.is_owned = false;
32606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32607 LDKPublicKey val_ref;
32608 CHECK((*env)->GetArrayLength(env, val) == 33);
32609 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32610 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
32613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32614 LDKOpenChannel this_ptr_conv;
32615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32616 this_ptr_conv.is_owned = false;
32617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32618 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32619 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
32623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32624 LDKOpenChannel this_ptr_conv;
32625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32626 this_ptr_conv.is_owned = false;
32627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32628 LDKPublicKey val_ref;
32629 CHECK((*env)->GetArrayLength(env, val) == 33);
32630 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32631 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32635 LDKOpenChannel this_ptr_conv;
32636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32637 this_ptr_conv.is_owned = false;
32638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32639 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32640 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
32644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32645 LDKOpenChannel this_ptr_conv;
32646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32647 this_ptr_conv.is_owned = false;
32648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32649 LDKPublicKey val_ref;
32650 CHECK((*env)->GetArrayLength(env, val) == 33);
32651 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32652 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
32655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32656 LDKOpenChannel this_ptr_conv;
32657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32658 this_ptr_conv.is_owned = false;
32659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32660 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32661 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
32665 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) {
32666 LDKOpenChannel this_ptr_conv;
32667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32668 this_ptr_conv.is_owned = false;
32669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32670 LDKPublicKey val_ref;
32671 CHECK((*env)->GetArrayLength(env, val) == 33);
32672 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32673 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
32676 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
32677 LDKOpenChannel this_ptr_conv;
32678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32679 this_ptr_conv.is_owned = false;
32680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32681 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
32685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
32686 LDKOpenChannel this_ptr_conv;
32687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32688 this_ptr_conv.is_owned = false;
32689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32690 OpenChannel_set_channel_flags(&this_ptr_conv, val);
32693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
32694 LDKOpenChannel this_ptr_conv;
32695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32696 this_ptr_conv.is_owned = false;
32697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32698 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
32699 int64_t ret_ref = 0;
32700 if ((uintptr_t)ret_var.inner > 4096) {
32701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32704 ret_ref = (uintptr_t)ret_var.inner;
32705 if (ret_var.is_owned) {
32712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32713 LDKOpenChannel this_ptr_conv;
32714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32715 this_ptr_conv.is_owned = false;
32716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32717 LDKChannelTypeFeatures val_conv;
32718 val_conv.inner = (void*)(val & (~1));
32719 val_conv.is_owned = (val & 1) || (val == 0);
32720 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32721 val_conv = ChannelTypeFeatures_clone(&val_conv);
32722 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
32725 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
32726 LDKOpenChannel ret_var = OpenChannel_clone(arg);
32727 int64_t ret_ref = 0;
32728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32731 ret_ref = (uintptr_t)ret_var.inner;
32732 if (ret_var.is_owned) {
32737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32738 LDKOpenChannel arg_conv;
32739 arg_conv.inner = (void*)(arg & (~1));
32740 arg_conv.is_owned = false;
32741 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32742 int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
32746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32747 LDKOpenChannel orig_conv;
32748 orig_conv.inner = (void*)(orig & (~1));
32749 orig_conv.is_owned = false;
32750 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32751 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
32752 int64_t ret_ref = 0;
32753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32756 ret_ref = (uintptr_t)ret_var.inner;
32757 if (ret_var.is_owned) {
32763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32764 LDKAcceptChannel this_obj_conv;
32765 this_obj_conv.inner = (void*)(this_obj & (~1));
32766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32768 AcceptChannel_free(this_obj_conv);
32771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32772 LDKAcceptChannel this_ptr_conv;
32773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32774 this_ptr_conv.is_owned = false;
32775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32776 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32777 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
32781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32782 LDKAcceptChannel this_ptr_conv;
32783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32784 this_ptr_conv.is_owned = false;
32785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32786 LDKThirtyTwoBytes val_ref;
32787 CHECK((*env)->GetArrayLength(env, val) == 32);
32788 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32789 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
32792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32793 LDKAcceptChannel this_ptr_conv;
32794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32795 this_ptr_conv.is_owned = false;
32796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32797 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
32801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32802 LDKAcceptChannel this_ptr_conv;
32803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32804 this_ptr_conv.is_owned = false;
32805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32806 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
32809 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) {
32810 LDKAcceptChannel this_ptr_conv;
32811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32812 this_ptr_conv.is_owned = false;
32813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32814 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
32818 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) {
32819 LDKAcceptChannel this_ptr_conv;
32820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32821 this_ptr_conv.is_owned = false;
32822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32823 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
32826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32827 LDKAcceptChannel this_ptr_conv;
32828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32829 this_ptr_conv.is_owned = false;
32830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32831 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
32835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32836 LDKAcceptChannel this_ptr_conv;
32837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32838 this_ptr_conv.is_owned = false;
32839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32840 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
32843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32844 LDKAcceptChannel this_ptr_conv;
32845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32846 this_ptr_conv.is_owned = false;
32847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32848 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
32852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32853 LDKAcceptChannel this_ptr_conv;
32854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32855 this_ptr_conv.is_owned = false;
32856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32857 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
32860 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
32861 LDKAcceptChannel this_ptr_conv;
32862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32863 this_ptr_conv.is_owned = false;
32864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32865 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
32869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32870 LDKAcceptChannel this_ptr_conv;
32871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32872 this_ptr_conv.is_owned = false;
32873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32874 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
32877 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
32878 LDKAcceptChannel this_ptr_conv;
32879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32880 this_ptr_conv.is_owned = false;
32881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32882 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
32886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32887 LDKAcceptChannel this_ptr_conv;
32888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32889 this_ptr_conv.is_owned = false;
32890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32891 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
32894 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32895 LDKAcceptChannel this_ptr_conv;
32896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32897 this_ptr_conv.is_owned = false;
32898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32899 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
32903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32904 LDKAcceptChannel this_ptr_conv;
32905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32906 this_ptr_conv.is_owned = false;
32907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32908 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
32911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32912 LDKAcceptChannel this_ptr_conv;
32913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32914 this_ptr_conv.is_owned = false;
32915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32916 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32917 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
32921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32922 LDKAcceptChannel this_ptr_conv;
32923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32924 this_ptr_conv.is_owned = false;
32925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32926 LDKPublicKey val_ref;
32927 CHECK((*env)->GetArrayLength(env, val) == 33);
32928 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32929 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
32932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32933 LDKAcceptChannel this_ptr_conv;
32934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32935 this_ptr_conv.is_owned = false;
32936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32937 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32938 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
32942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32943 LDKAcceptChannel this_ptr_conv;
32944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32945 this_ptr_conv.is_owned = false;
32946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32947 LDKPublicKey val_ref;
32948 CHECK((*env)->GetArrayLength(env, val) == 33);
32949 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32950 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
32953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32954 LDKAcceptChannel this_ptr_conv;
32955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32956 this_ptr_conv.is_owned = false;
32957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32958 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32959 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
32963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32964 LDKAcceptChannel this_ptr_conv;
32965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32966 this_ptr_conv.is_owned = false;
32967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32968 LDKPublicKey val_ref;
32969 CHECK((*env)->GetArrayLength(env, val) == 33);
32970 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32971 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
32974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32975 LDKAcceptChannel this_ptr_conv;
32976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32977 this_ptr_conv.is_owned = false;
32978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32979 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32980 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
32984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32985 LDKAcceptChannel this_ptr_conv;
32986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32987 this_ptr_conv.is_owned = false;
32988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32989 LDKPublicKey val_ref;
32990 CHECK((*env)->GetArrayLength(env, val) == 33);
32991 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32992 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
32996 LDKAcceptChannel this_ptr_conv;
32997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32998 this_ptr_conv.is_owned = false;
32999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33000 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33001 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
33005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33006 LDKAcceptChannel this_ptr_conv;
33007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33008 this_ptr_conv.is_owned = false;
33009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33010 LDKPublicKey val_ref;
33011 CHECK((*env)->GetArrayLength(env, val) == 33);
33012 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33013 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
33016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33017 LDKAcceptChannel this_ptr_conv;
33018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33019 this_ptr_conv.is_owned = false;
33020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33021 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33022 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
33026 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) {
33027 LDKAcceptChannel this_ptr_conv;
33028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33029 this_ptr_conv.is_owned = false;
33030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33031 LDKPublicKey val_ref;
33032 CHECK((*env)->GetArrayLength(env, val) == 33);
33033 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33034 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
33037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
33038 LDKAcceptChannel this_ptr_conv;
33039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33040 this_ptr_conv.is_owned = false;
33041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33042 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
33043 int64_t ret_ref = 0;
33044 if ((uintptr_t)ret_var.inner > 4096) {
33045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33048 ret_ref = (uintptr_t)ret_var.inner;
33049 if (ret_var.is_owned) {
33056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33057 LDKAcceptChannel this_ptr_conv;
33058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33059 this_ptr_conv.is_owned = false;
33060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33061 LDKChannelTypeFeatures val_conv;
33062 val_conv.inner = (void*)(val & (~1));
33063 val_conv.is_owned = (val & 1) || (val == 0);
33064 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33065 val_conv = ChannelTypeFeatures_clone(&val_conv);
33066 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
33069 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
33070 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
33071 int64_t ret_ref = 0;
33072 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33073 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33074 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33075 ret_ref = (uintptr_t)ret_var.inner;
33076 if (ret_var.is_owned) {
33081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33082 LDKAcceptChannel arg_conv;
33083 arg_conv.inner = (void*)(arg & (~1));
33084 arg_conv.is_owned = false;
33085 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33086 int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
33090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33091 LDKAcceptChannel orig_conv;
33092 orig_conv.inner = (void*)(orig & (~1));
33093 orig_conv.is_owned = false;
33094 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33095 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
33096 int64_t ret_ref = 0;
33097 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33098 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33100 ret_ref = (uintptr_t)ret_var.inner;
33101 if (ret_var.is_owned) {
33107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33108 LDKFundingCreated this_obj_conv;
33109 this_obj_conv.inner = (void*)(this_obj & (~1));
33110 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33112 FundingCreated_free(this_obj_conv);
33115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33116 LDKFundingCreated this_ptr_conv;
33117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33118 this_ptr_conv.is_owned = false;
33119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33120 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33121 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
33125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33126 LDKFundingCreated this_ptr_conv;
33127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33128 this_ptr_conv.is_owned = false;
33129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33130 LDKThirtyTwoBytes val_ref;
33131 CHECK((*env)->GetArrayLength(env, val) == 32);
33132 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33133 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
33136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
33137 LDKFundingCreated this_ptr_conv;
33138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33139 this_ptr_conv.is_owned = false;
33140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33141 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33142 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
33146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33147 LDKFundingCreated this_ptr_conv;
33148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33149 this_ptr_conv.is_owned = false;
33150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33151 LDKThirtyTwoBytes val_ref;
33152 CHECK((*env)->GetArrayLength(env, val) == 32);
33153 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33154 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
33157 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
33158 LDKFundingCreated this_ptr_conv;
33159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33160 this_ptr_conv.is_owned = false;
33161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33162 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
33166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33167 LDKFundingCreated this_ptr_conv;
33168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33169 this_ptr_conv.is_owned = false;
33170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33171 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
33174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33175 LDKFundingCreated 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
33184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33185 LDKFundingCreated this_ptr_conv;
33186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33187 this_ptr_conv.is_owned = false;
33188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33189 LDKSignature val_ref;
33190 CHECK((*env)->GetArrayLength(env, val) == 64);
33191 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33192 FundingCreated_set_signature(&this_ptr_conv, val_ref);
33195 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) {
33196 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
33197 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
33198 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
33199 LDKThirtyTwoBytes funding_txid_arg_ref;
33200 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
33201 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
33202 LDKSignature signature_arg_ref;
33203 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33204 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33205 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
33206 int64_t ret_ref = 0;
33207 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33208 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33210 ret_ref = (uintptr_t)ret_var.inner;
33211 if (ret_var.is_owned) {
33217 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
33218 LDKFundingCreated ret_var = FundingCreated_clone(arg);
33219 int64_t ret_ref = 0;
33220 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33221 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33223 ret_ref = (uintptr_t)ret_var.inner;
33224 if (ret_var.is_owned) {
33229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33230 LDKFundingCreated arg_conv;
33231 arg_conv.inner = (void*)(arg & (~1));
33232 arg_conv.is_owned = false;
33233 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33234 int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
33238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33239 LDKFundingCreated orig_conv;
33240 orig_conv.inner = (void*)(orig & (~1));
33241 orig_conv.is_owned = false;
33242 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33243 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
33244 int64_t ret_ref = 0;
33245 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33246 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33248 ret_ref = (uintptr_t)ret_var.inner;
33249 if (ret_var.is_owned) {
33255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33256 LDKFundingSigned this_obj_conv;
33257 this_obj_conv.inner = (void*)(this_obj & (~1));
33258 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33260 FundingSigned_free(this_obj_conv);
33263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33264 LDKFundingSigned this_ptr_conv;
33265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33266 this_ptr_conv.is_owned = false;
33267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33268 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33269 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
33273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33274 LDKFundingSigned this_ptr_conv;
33275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33276 this_ptr_conv.is_owned = false;
33277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33278 LDKThirtyTwoBytes val_ref;
33279 CHECK((*env)->GetArrayLength(env, val) == 32);
33280 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33281 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
33284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33285 LDKFundingSigned this_ptr_conv;
33286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33287 this_ptr_conv.is_owned = false;
33288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33289 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33290 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
33294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33295 LDKFundingSigned this_ptr_conv;
33296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33297 this_ptr_conv.is_owned = false;
33298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33299 LDKSignature val_ref;
33300 CHECK((*env)->GetArrayLength(env, val) == 64);
33301 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33302 FundingSigned_set_signature(&this_ptr_conv, val_ref);
33305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
33306 LDKThirtyTwoBytes channel_id_arg_ref;
33307 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33308 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33309 LDKSignature signature_arg_ref;
33310 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33311 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33312 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
33313 int64_t ret_ref = 0;
33314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33317 ret_ref = (uintptr_t)ret_var.inner;
33318 if (ret_var.is_owned) {
33324 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
33325 LDKFundingSigned ret_var = FundingSigned_clone(arg);
33326 int64_t ret_ref = 0;
33327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33330 ret_ref = (uintptr_t)ret_var.inner;
33331 if (ret_var.is_owned) {
33336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33337 LDKFundingSigned arg_conv;
33338 arg_conv.inner = (void*)(arg & (~1));
33339 arg_conv.is_owned = false;
33340 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33341 int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
33345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33346 LDKFundingSigned orig_conv;
33347 orig_conv.inner = (void*)(orig & (~1));
33348 orig_conv.is_owned = false;
33349 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33350 LDKFundingSigned ret_var = FundingSigned_clone(&orig_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_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33363 LDKChannelReady this_obj_conv;
33364 this_obj_conv.inner = (void*)(this_obj & (~1));
33365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33367 ChannelReady_free(this_obj_conv);
33370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33371 LDKChannelReady this_ptr_conv;
33372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33373 this_ptr_conv.is_owned = false;
33374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33375 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33376 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
33380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33381 LDKChannelReady this_ptr_conv;
33382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33383 this_ptr_conv.is_owned = false;
33384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33385 LDKThirtyTwoBytes val_ref;
33386 CHECK((*env)->GetArrayLength(env, val) == 32);
33387 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33388 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
33391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33392 LDKChannelReady this_ptr_conv;
33393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33394 this_ptr_conv.is_owned = false;
33395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33396 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33397 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33402 LDKChannelReady this_ptr_conv;
33403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33404 this_ptr_conv.is_owned = false;
33405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33406 LDKPublicKey val_ref;
33407 CHECK((*env)->GetArrayLength(env, val) == 33);
33408 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33409 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33413 LDKChannelReady this_ptr_conv;
33414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33415 this_ptr_conv.is_owned = false;
33416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33417 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33418 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
33419 int64_t ret_ref = (uintptr_t)ret_copy;
33423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33424 LDKChannelReady this_ptr_conv;
33425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33426 this_ptr_conv.is_owned = false;
33427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33428 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33429 CHECK_ACCESS(val_ptr);
33430 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33431 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
33432 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
33435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
33436 LDKThirtyTwoBytes channel_id_arg_ref;
33437 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33438 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33439 LDKPublicKey next_per_commitment_point_arg_ref;
33440 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33441 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33442 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
33443 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
33444 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
33445 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
33446 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
33447 int64_t ret_ref = 0;
33448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33451 ret_ref = (uintptr_t)ret_var.inner;
33452 if (ret_var.is_owned) {
33458 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
33459 LDKChannelReady ret_var = ChannelReady_clone(arg);
33460 int64_t ret_ref = 0;
33461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33464 ret_ref = (uintptr_t)ret_var.inner;
33465 if (ret_var.is_owned) {
33470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33471 LDKChannelReady arg_conv;
33472 arg_conv.inner = (void*)(arg & (~1));
33473 arg_conv.is_owned = false;
33474 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33475 int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
33479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33480 LDKChannelReady orig_conv;
33481 orig_conv.inner = (void*)(orig & (~1));
33482 orig_conv.is_owned = false;
33483 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33484 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
33485 int64_t ret_ref = 0;
33486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33489 ret_ref = (uintptr_t)ret_var.inner;
33490 if (ret_var.is_owned) {
33496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33497 LDKShutdown this_obj_conv;
33498 this_obj_conv.inner = (void*)(this_obj & (~1));
33499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33501 Shutdown_free(this_obj_conv);
33504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33505 LDKShutdown this_ptr_conv;
33506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33507 this_ptr_conv.is_owned = false;
33508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33509 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
33514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33515 LDKShutdown this_ptr_conv;
33516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33517 this_ptr_conv.is_owned = false;
33518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33519 LDKThirtyTwoBytes val_ref;
33520 CHECK((*env)->GetArrayLength(env, val) == 32);
33521 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33522 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
33525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
33526 LDKShutdown this_ptr_conv;
33527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33528 this_ptr_conv.is_owned = false;
33529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33530 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
33531 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33532 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33537 LDKShutdown this_ptr_conv;
33538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33539 this_ptr_conv.is_owned = false;
33540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33541 LDKCVec_u8Z val_ref;
33542 val_ref.datalen = (*env)->GetArrayLength(env, val);
33543 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
33544 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
33545 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
33548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
33549 LDKThirtyTwoBytes channel_id_arg_ref;
33550 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33551 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33552 LDKCVec_u8Z scriptpubkey_arg_ref;
33553 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
33554 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
33555 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
33556 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
33557 int64_t ret_ref = 0;
33558 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33559 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33561 ret_ref = (uintptr_t)ret_var.inner;
33562 if (ret_var.is_owned) {
33568 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
33569 LDKShutdown ret_var = Shutdown_clone(arg);
33570 int64_t ret_ref = 0;
33571 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33572 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33574 ret_ref = (uintptr_t)ret_var.inner;
33575 if (ret_var.is_owned) {
33580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33581 LDKShutdown arg_conv;
33582 arg_conv.inner = (void*)(arg & (~1));
33583 arg_conv.is_owned = false;
33584 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33585 int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
33589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33590 LDKShutdown orig_conv;
33591 orig_conv.inner = (void*)(orig & (~1));
33592 orig_conv.is_owned = false;
33593 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33594 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
33595 int64_t ret_ref = 0;
33596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33599 ret_ref = (uintptr_t)ret_var.inner;
33600 if (ret_var.is_owned) {
33606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33607 LDKClosingSignedFeeRange this_obj_conv;
33608 this_obj_conv.inner = (void*)(this_obj & (~1));
33609 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33611 ClosingSignedFeeRange_free(this_obj_conv);
33614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33615 LDKClosingSignedFeeRange this_ptr_conv;
33616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33617 this_ptr_conv.is_owned = false;
33618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33619 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
33623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33624 LDKClosingSignedFeeRange this_ptr_conv;
33625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33626 this_ptr_conv.is_owned = false;
33627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33628 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
33631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33632 LDKClosingSignedFeeRange this_ptr_conv;
33633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33634 this_ptr_conv.is_owned = false;
33635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33636 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
33640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33641 LDKClosingSignedFeeRange 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 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
33648 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) {
33649 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
33650 int64_t ret_ref = 0;
33651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33654 ret_ref = (uintptr_t)ret_var.inner;
33655 if (ret_var.is_owned) {
33661 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
33662 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
33663 int64_t ret_ref = 0;
33664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33667 ret_ref = (uintptr_t)ret_var.inner;
33668 if (ret_var.is_owned) {
33673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33674 LDKClosingSignedFeeRange arg_conv;
33675 arg_conv.inner = (void*)(arg & (~1));
33676 arg_conv.is_owned = false;
33677 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33678 int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
33682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33683 LDKClosingSignedFeeRange orig_conv;
33684 orig_conv.inner = (void*)(orig & (~1));
33685 orig_conv.is_owned = false;
33686 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33687 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
33688 int64_t ret_ref = 0;
33689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33692 ret_ref = (uintptr_t)ret_var.inner;
33693 if (ret_var.is_owned) {
33699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33700 LDKClosingSigned this_obj_conv;
33701 this_obj_conv.inner = (void*)(this_obj & (~1));
33702 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33704 ClosingSigned_free(this_obj_conv);
33707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33708 LDKClosingSigned this_ptr_conv;
33709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33710 this_ptr_conv.is_owned = false;
33711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33712 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33713 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
33717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33718 LDKClosingSigned this_ptr_conv;
33719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33720 this_ptr_conv.is_owned = false;
33721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33722 LDKThirtyTwoBytes val_ref;
33723 CHECK((*env)->GetArrayLength(env, val) == 32);
33724 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33725 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
33728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33729 LDKClosingSigned this_ptr_conv;
33730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33731 this_ptr_conv.is_owned = false;
33732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33733 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
33737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33738 LDKClosingSigned this_ptr_conv;
33739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33740 this_ptr_conv.is_owned = false;
33741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33742 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
33745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33746 LDKClosingSigned this_ptr_conv;
33747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33748 this_ptr_conv.is_owned = false;
33749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33750 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33751 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
33755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33756 LDKClosingSigned this_ptr_conv;
33757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33758 this_ptr_conv.is_owned = false;
33759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33760 LDKSignature val_ref;
33761 CHECK((*env)->GetArrayLength(env, val) == 64);
33762 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33763 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
33766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
33767 LDKClosingSigned this_ptr_conv;
33768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33769 this_ptr_conv.is_owned = false;
33770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33771 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
33772 int64_t ret_ref = 0;
33773 if ((uintptr_t)ret_var.inner > 4096) {
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) {
33785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33786 LDKClosingSigned this_ptr_conv;
33787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33788 this_ptr_conv.is_owned = false;
33789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33790 LDKClosingSignedFeeRange val_conv;
33791 val_conv.inner = (void*)(val & (~1));
33792 val_conv.is_owned = (val & 1) || (val == 0);
33793 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33794 val_conv = ClosingSignedFeeRange_clone(&val_conv);
33795 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
33798 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) {
33799 LDKThirtyTwoBytes channel_id_arg_ref;
33800 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33801 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33802 LDKSignature signature_arg_ref;
33803 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33804 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33805 LDKClosingSignedFeeRange fee_range_arg_conv;
33806 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
33807 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
33808 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
33809 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
33810 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_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 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
33823 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
33824 int64_t ret_ref = 0;
33825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33828 ret_ref = (uintptr_t)ret_var.inner;
33829 if (ret_var.is_owned) {
33834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33835 LDKClosingSigned arg_conv;
33836 arg_conv.inner = (void*)(arg & (~1));
33837 arg_conv.is_owned = false;
33838 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33839 int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
33843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33844 LDKClosingSigned orig_conv;
33845 orig_conv.inner = (void*)(orig & (~1));
33846 orig_conv.is_owned = false;
33847 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33848 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
33849 int64_t ret_ref = 0;
33850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33853 ret_ref = (uintptr_t)ret_var.inner;
33854 if (ret_var.is_owned) {
33860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33861 LDKUpdateAddHTLC this_obj_conv;
33862 this_obj_conv.inner = (void*)(this_obj & (~1));
33863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33865 UpdateAddHTLC_free(this_obj_conv);
33868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33869 LDKUpdateAddHTLC 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
33878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33879 LDKUpdateAddHTLC this_ptr_conv;
33880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33881 this_ptr_conv.is_owned = false;
33882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33883 LDKThirtyTwoBytes val_ref;
33884 CHECK((*env)->GetArrayLength(env, val) == 32);
33885 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33886 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
33889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33890 LDKUpdateAddHTLC this_ptr_conv;
33891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33892 this_ptr_conv.is_owned = false;
33893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33894 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
33898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33899 LDKUpdateAddHTLC this_ptr_conv;
33900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33901 this_ptr_conv.is_owned = false;
33902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33903 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
33906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33907 LDKUpdateAddHTLC this_ptr_conv;
33908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33909 this_ptr_conv.is_owned = false;
33910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33911 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
33915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33916 LDKUpdateAddHTLC this_ptr_conv;
33917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33918 this_ptr_conv.is_owned = false;
33919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33920 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
33923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33924 LDKUpdateAddHTLC this_ptr_conv;
33925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33926 this_ptr_conv.is_owned = false;
33927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33928 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33929 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
33933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33934 LDKUpdateAddHTLC this_ptr_conv;
33935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33936 this_ptr_conv.is_owned = false;
33937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33938 LDKThirtyTwoBytes val_ref;
33939 CHECK((*env)->GetArrayLength(env, val) == 32);
33940 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33941 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
33944 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
33945 LDKUpdateAddHTLC this_ptr_conv;
33946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33947 this_ptr_conv.is_owned = false;
33948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33949 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
33953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33954 LDKUpdateAddHTLC 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 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
33961 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
33962 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
33963 int64_t ret_ref = 0;
33964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33967 ret_ref = (uintptr_t)ret_var.inner;
33968 if (ret_var.is_owned) {
33973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33974 LDKUpdateAddHTLC arg_conv;
33975 arg_conv.inner = (void*)(arg & (~1));
33976 arg_conv.is_owned = false;
33977 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33978 int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
33982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33983 LDKUpdateAddHTLC orig_conv;
33984 orig_conv.inner = (void*)(orig & (~1));
33985 orig_conv.is_owned = false;
33986 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33987 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
33988 int64_t ret_ref = 0;
33989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33992 ret_ref = (uintptr_t)ret_var.inner;
33993 if (ret_var.is_owned) {
33999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34000 LDKUpdateFulfillHTLC this_obj_conv;
34001 this_obj_conv.inner = (void*)(this_obj & (~1));
34002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34004 UpdateFulfillHTLC_free(this_obj_conv);
34007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34008 LDKUpdateFulfillHTLC this_ptr_conv;
34009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34010 this_ptr_conv.is_owned = false;
34011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34012 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34013 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
34017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34018 LDKUpdateFulfillHTLC this_ptr_conv;
34019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34020 this_ptr_conv.is_owned = false;
34021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34022 LDKThirtyTwoBytes val_ref;
34023 CHECK((*env)->GetArrayLength(env, val) == 32);
34024 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34025 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
34028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34029 LDKUpdateFulfillHTLC this_ptr_conv;
34030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34031 this_ptr_conv.is_owned = false;
34032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34033 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
34037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34038 LDKUpdateFulfillHTLC 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 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
34045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
34046 LDKUpdateFulfillHTLC this_ptr_conv;
34047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34048 this_ptr_conv.is_owned = false;
34049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34050 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34051 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
34055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34056 LDKUpdateFulfillHTLC this_ptr_conv;
34057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34058 this_ptr_conv.is_owned = false;
34059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34060 LDKThirtyTwoBytes val_ref;
34061 CHECK((*env)->GetArrayLength(env, val) == 32);
34062 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34063 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
34066 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) {
34067 LDKThirtyTwoBytes channel_id_arg_ref;
34068 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34069 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34070 LDKThirtyTwoBytes payment_preimage_arg_ref;
34071 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
34072 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
34073 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
34074 int64_t ret_ref = 0;
34075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34078 ret_ref = (uintptr_t)ret_var.inner;
34079 if (ret_var.is_owned) {
34085 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
34086 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
34087 int64_t ret_ref = 0;
34088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34091 ret_ref = (uintptr_t)ret_var.inner;
34092 if (ret_var.is_owned) {
34097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34098 LDKUpdateFulfillHTLC arg_conv;
34099 arg_conv.inner = (void*)(arg & (~1));
34100 arg_conv.is_owned = false;
34101 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34102 int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
34106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34107 LDKUpdateFulfillHTLC orig_conv;
34108 orig_conv.inner = (void*)(orig & (~1));
34109 orig_conv.is_owned = false;
34110 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34111 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
34112 int64_t ret_ref = 0;
34113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34116 ret_ref = (uintptr_t)ret_var.inner;
34117 if (ret_var.is_owned) {
34123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34124 LDKUpdateFailHTLC this_obj_conv;
34125 this_obj_conv.inner = (void*)(this_obj & (~1));
34126 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34128 UpdateFailHTLC_free(this_obj_conv);
34131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34132 LDKUpdateFailHTLC this_ptr_conv;
34133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34134 this_ptr_conv.is_owned = false;
34135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34136 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34137 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
34141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34142 LDKUpdateFailHTLC this_ptr_conv;
34143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34144 this_ptr_conv.is_owned = false;
34145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34146 LDKThirtyTwoBytes val_ref;
34147 CHECK((*env)->GetArrayLength(env, val) == 32);
34148 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34149 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
34152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34153 LDKUpdateFailHTLC this_ptr_conv;
34154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34155 this_ptr_conv.is_owned = false;
34156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34157 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
34161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34162 LDKUpdateFailHTLC this_ptr_conv;
34163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34164 this_ptr_conv.is_owned = false;
34165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34166 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
34169 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
34170 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
34171 int64_t ret_ref = 0;
34172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34175 ret_ref = (uintptr_t)ret_var.inner;
34176 if (ret_var.is_owned) {
34181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34182 LDKUpdateFailHTLC arg_conv;
34183 arg_conv.inner = (void*)(arg & (~1));
34184 arg_conv.is_owned = false;
34185 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34186 int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
34190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34191 LDKUpdateFailHTLC orig_conv;
34192 orig_conv.inner = (void*)(orig & (~1));
34193 orig_conv.is_owned = false;
34194 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34195 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
34196 int64_t ret_ref = 0;
34197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34200 ret_ref = (uintptr_t)ret_var.inner;
34201 if (ret_var.is_owned) {
34207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34208 LDKUpdateFailMalformedHTLC this_obj_conv;
34209 this_obj_conv.inner = (void*)(this_obj & (~1));
34210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34212 UpdateFailMalformedHTLC_free(this_obj_conv);
34215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34216 LDKUpdateFailMalformedHTLC this_ptr_conv;
34217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34218 this_ptr_conv.is_owned = false;
34219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34220 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
34225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34226 LDKUpdateFailMalformedHTLC this_ptr_conv;
34227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34228 this_ptr_conv.is_owned = false;
34229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34230 LDKThirtyTwoBytes val_ref;
34231 CHECK((*env)->GetArrayLength(env, val) == 32);
34232 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34233 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
34236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34237 LDKUpdateFailMalformedHTLC this_ptr_conv;
34238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34239 this_ptr_conv.is_owned = false;
34240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34241 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
34245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34246 LDKUpdateFailMalformedHTLC this_ptr_conv;
34247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34248 this_ptr_conv.is_owned = false;
34249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34250 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
34253 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
34254 LDKUpdateFailMalformedHTLC this_ptr_conv;
34255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34256 this_ptr_conv.is_owned = false;
34257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34258 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
34262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34263 LDKUpdateFailMalformedHTLC this_ptr_conv;
34264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34265 this_ptr_conv.is_owned = false;
34266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34267 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
34270 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
34271 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
34272 int64_t ret_ref = 0;
34273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34276 ret_ref = (uintptr_t)ret_var.inner;
34277 if (ret_var.is_owned) {
34282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34283 LDKUpdateFailMalformedHTLC arg_conv;
34284 arg_conv.inner = (void*)(arg & (~1));
34285 arg_conv.is_owned = false;
34286 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34287 int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
34291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34292 LDKUpdateFailMalformedHTLC orig_conv;
34293 orig_conv.inner = (void*)(orig & (~1));
34294 orig_conv.is_owned = false;
34295 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34296 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
34297 int64_t ret_ref = 0;
34298 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34299 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34301 ret_ref = (uintptr_t)ret_var.inner;
34302 if (ret_var.is_owned) {
34308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34309 LDKCommitmentSigned this_obj_conv;
34310 this_obj_conv.inner = (void*)(this_obj & (~1));
34311 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34313 CommitmentSigned_free(this_obj_conv);
34316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34317 LDKCommitmentSigned this_ptr_conv;
34318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34319 this_ptr_conv.is_owned = false;
34320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34321 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
34326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34327 LDKCommitmentSigned this_ptr_conv;
34328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34329 this_ptr_conv.is_owned = false;
34330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34331 LDKThirtyTwoBytes val_ref;
34332 CHECK((*env)->GetArrayLength(env, val) == 32);
34333 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34334 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
34337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34338 LDKCommitmentSigned this_ptr_conv;
34339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34340 this_ptr_conv.is_owned = false;
34341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34342 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34343 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
34347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34348 LDKCommitmentSigned this_ptr_conv;
34349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34350 this_ptr_conv.is_owned = false;
34351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34352 LDKSignature val_ref;
34353 CHECK((*env)->GetArrayLength(env, val) == 64);
34354 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34355 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
34358 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
34359 LDKCommitmentSigned this_ptr_conv;
34360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34361 this_ptr_conv.is_owned = false;
34362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34363 LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
34364 jobjectArray ret_arr = NULL;
34365 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
34367 for (size_t i = 0; i < ret_var.datalen; i++) {
34368 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
34369 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
34370 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
34373 FREE(ret_var.data);
34377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
34378 LDKCommitmentSigned this_ptr_conv;
34379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34380 this_ptr_conv.is_owned = false;
34381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34382 LDKCVec_SignatureZ val_constr;
34383 val_constr.datalen = (*env)->GetArrayLength(env, val);
34384 if (val_constr.datalen > 0)
34385 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34387 val_constr.data = NULL;
34388 for (size_t i = 0; i < val_constr.datalen; i++) {
34389 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
34390 LDKSignature val_conv_8_ref;
34391 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
34392 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
34393 val_constr.data[i] = val_conv_8_ref;
34395 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
34398 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) {
34399 LDKThirtyTwoBytes channel_id_arg_ref;
34400 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34401 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34402 LDKSignature signature_arg_ref;
34403 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34404 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34405 LDKCVec_SignatureZ htlc_signatures_arg_constr;
34406 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
34407 if (htlc_signatures_arg_constr.datalen > 0)
34408 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34410 htlc_signatures_arg_constr.data = NULL;
34411 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
34412 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
34413 LDKSignature htlc_signatures_arg_conv_8_ref;
34414 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
34415 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
34416 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
34418 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
34419 int64_t ret_ref = 0;
34420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34423 ret_ref = (uintptr_t)ret_var.inner;
34424 if (ret_var.is_owned) {
34430 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
34431 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
34432 int64_t ret_ref = 0;
34433 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34434 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34436 ret_ref = (uintptr_t)ret_var.inner;
34437 if (ret_var.is_owned) {
34442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34443 LDKCommitmentSigned arg_conv;
34444 arg_conv.inner = (void*)(arg & (~1));
34445 arg_conv.is_owned = false;
34446 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34447 int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
34451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34452 LDKCommitmentSigned orig_conv;
34453 orig_conv.inner = (void*)(orig & (~1));
34454 orig_conv.is_owned = false;
34455 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34456 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
34457 int64_t ret_ref = 0;
34458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34461 ret_ref = (uintptr_t)ret_var.inner;
34462 if (ret_var.is_owned) {
34468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34469 LDKRevokeAndACK this_obj_conv;
34470 this_obj_conv.inner = (void*)(this_obj & (~1));
34471 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34473 RevokeAndACK_free(this_obj_conv);
34476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34477 LDKRevokeAndACK this_ptr_conv;
34478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34479 this_ptr_conv.is_owned = false;
34480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34481 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34482 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
34486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34487 LDKRevokeAndACK this_ptr_conv;
34488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34489 this_ptr_conv.is_owned = false;
34490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34491 LDKThirtyTwoBytes val_ref;
34492 CHECK((*env)->GetArrayLength(env, val) == 32);
34493 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34494 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
34497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
34498 LDKRevokeAndACK this_ptr_conv;
34499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34500 this_ptr_conv.is_owned = false;
34501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34502 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34503 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
34507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34508 LDKRevokeAndACK this_ptr_conv;
34509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34510 this_ptr_conv.is_owned = false;
34511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34512 LDKThirtyTwoBytes val_ref;
34513 CHECK((*env)->GetArrayLength(env, val) == 32);
34514 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34515 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
34518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34519 LDKRevokeAndACK this_ptr_conv;
34520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34521 this_ptr_conv.is_owned = false;
34522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34523 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34524 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
34528 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) {
34529 LDKRevokeAndACK this_ptr_conv;
34530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34531 this_ptr_conv.is_owned = false;
34532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34533 LDKPublicKey val_ref;
34534 CHECK((*env)->GetArrayLength(env, val) == 33);
34535 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34536 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
34539 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) {
34540 LDKThirtyTwoBytes channel_id_arg_ref;
34541 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34542 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34543 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
34544 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
34545 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
34546 LDKPublicKey next_per_commitment_point_arg_ref;
34547 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
34548 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
34549 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
34550 int64_t ret_ref = 0;
34551 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34552 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34554 ret_ref = (uintptr_t)ret_var.inner;
34555 if (ret_var.is_owned) {
34561 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
34562 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
34563 int64_t ret_ref = 0;
34564 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34565 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34567 ret_ref = (uintptr_t)ret_var.inner;
34568 if (ret_var.is_owned) {
34573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34574 LDKRevokeAndACK arg_conv;
34575 arg_conv.inner = (void*)(arg & (~1));
34576 arg_conv.is_owned = false;
34577 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34578 int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
34582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34583 LDKRevokeAndACK orig_conv;
34584 orig_conv.inner = (void*)(orig & (~1));
34585 orig_conv.is_owned = false;
34586 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34587 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
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) {
34599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34600 LDKUpdateFee this_obj_conv;
34601 this_obj_conv.inner = (void*)(this_obj & (~1));
34602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34604 UpdateFee_free(this_obj_conv);
34607 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34608 LDKUpdateFee this_ptr_conv;
34609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34610 this_ptr_conv.is_owned = false;
34611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34612 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34613 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
34617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34618 LDKUpdateFee this_ptr_conv;
34619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34620 this_ptr_conv.is_owned = false;
34621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34622 LDKThirtyTwoBytes val_ref;
34623 CHECK((*env)->GetArrayLength(env, val) == 32);
34624 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34625 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
34628 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
34629 LDKUpdateFee this_ptr_conv;
34630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34631 this_ptr_conv.is_owned = false;
34632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34633 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
34637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34638 LDKUpdateFee this_ptr_conv;
34639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34640 this_ptr_conv.is_owned = false;
34641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34642 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
34645 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) {
34646 LDKThirtyTwoBytes channel_id_arg_ref;
34647 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34648 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34649 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
34650 int64_t ret_ref = 0;
34651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34654 ret_ref = (uintptr_t)ret_var.inner;
34655 if (ret_var.is_owned) {
34661 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
34662 LDKUpdateFee ret_var = UpdateFee_clone(arg);
34663 int64_t ret_ref = 0;
34664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34667 ret_ref = (uintptr_t)ret_var.inner;
34668 if (ret_var.is_owned) {
34673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34674 LDKUpdateFee arg_conv;
34675 arg_conv.inner = (void*)(arg & (~1));
34676 arg_conv.is_owned = false;
34677 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34678 int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
34682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34683 LDKUpdateFee orig_conv;
34684 orig_conv.inner = (void*)(orig & (~1));
34685 orig_conv.is_owned = false;
34686 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34687 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
34688 int64_t ret_ref = 0;
34689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34692 ret_ref = (uintptr_t)ret_var.inner;
34693 if (ret_var.is_owned) {
34699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34700 LDKDataLossProtect this_obj_conv;
34701 this_obj_conv.inner = (void*)(this_obj & (~1));
34702 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34704 DataLossProtect_free(this_obj_conv);
34707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
34708 LDKDataLossProtect this_ptr_conv;
34709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34710 this_ptr_conv.is_owned = false;
34711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34712 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34713 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
34717 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) {
34718 LDKDataLossProtect this_ptr_conv;
34719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34720 this_ptr_conv.is_owned = false;
34721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34722 LDKThirtyTwoBytes val_ref;
34723 CHECK((*env)->GetArrayLength(env, val) == 32);
34724 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34725 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
34728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34729 LDKDataLossProtect this_ptr_conv;
34730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34731 this_ptr_conv.is_owned = false;
34732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34733 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34734 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
34738 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) {
34739 LDKDataLossProtect this_ptr_conv;
34740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34741 this_ptr_conv.is_owned = false;
34742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34743 LDKPublicKey val_ref;
34744 CHECK((*env)->GetArrayLength(env, val) == 33);
34745 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34746 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
34749 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) {
34750 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
34751 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
34752 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
34753 LDKPublicKey my_current_per_commitment_point_arg_ref;
34754 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
34755 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
34756 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
34757 int64_t ret_ref = 0;
34758 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34759 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34761 ret_ref = (uintptr_t)ret_var.inner;
34762 if (ret_var.is_owned) {
34768 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
34769 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
34770 int64_t ret_ref = 0;
34771 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34772 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34774 ret_ref = (uintptr_t)ret_var.inner;
34775 if (ret_var.is_owned) {
34780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34781 LDKDataLossProtect arg_conv;
34782 arg_conv.inner = (void*)(arg & (~1));
34783 arg_conv.is_owned = false;
34784 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34785 int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
34789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34790 LDKDataLossProtect orig_conv;
34791 orig_conv.inner = (void*)(orig & (~1));
34792 orig_conv.is_owned = false;
34793 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34794 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
34795 int64_t ret_ref = 0;
34796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34799 ret_ref = (uintptr_t)ret_var.inner;
34800 if (ret_var.is_owned) {
34806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34807 LDKChannelReestablish this_obj_conv;
34808 this_obj_conv.inner = (void*)(this_obj & (~1));
34809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34811 ChannelReestablish_free(this_obj_conv);
34814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34815 LDKChannelReestablish this_ptr_conv;
34816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34817 this_ptr_conv.is_owned = false;
34818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34819 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34820 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
34824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34825 LDKChannelReestablish this_ptr_conv;
34826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34827 this_ptr_conv.is_owned = false;
34828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34829 LDKThirtyTwoBytes val_ref;
34830 CHECK((*env)->GetArrayLength(env, val) == 32);
34831 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34832 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
34835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
34836 LDKChannelReestablish this_ptr_conv;
34837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34838 this_ptr_conv.is_owned = false;
34839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34840 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
34844 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) {
34845 LDKChannelReestablish this_ptr_conv;
34846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34847 this_ptr_conv.is_owned = false;
34848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34849 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
34852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
34853 LDKChannelReestablish this_ptr_conv;
34854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34855 this_ptr_conv.is_owned = false;
34856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34857 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
34861 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) {
34862 LDKChannelReestablish this_ptr_conv;
34863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34864 this_ptr_conv.is_owned = false;
34865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34866 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
34869 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
34870 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
34871 int64_t ret_ref = 0;
34872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34875 ret_ref = (uintptr_t)ret_var.inner;
34876 if (ret_var.is_owned) {
34881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34882 LDKChannelReestablish arg_conv;
34883 arg_conv.inner = (void*)(arg & (~1));
34884 arg_conv.is_owned = false;
34885 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34886 int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
34890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34891 LDKChannelReestablish orig_conv;
34892 orig_conv.inner = (void*)(orig & (~1));
34893 orig_conv.is_owned = false;
34894 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34895 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
34896 int64_t ret_ref = 0;
34897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34900 ret_ref = (uintptr_t)ret_var.inner;
34901 if (ret_var.is_owned) {
34907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34908 LDKAnnouncementSignatures this_obj_conv;
34909 this_obj_conv.inner = (void*)(this_obj & (~1));
34910 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34912 AnnouncementSignatures_free(this_obj_conv);
34915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34916 LDKAnnouncementSignatures this_ptr_conv;
34917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34918 this_ptr_conv.is_owned = false;
34919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34920 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34921 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
34925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34926 LDKAnnouncementSignatures this_ptr_conv;
34927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34928 this_ptr_conv.is_owned = false;
34929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34930 LDKThirtyTwoBytes val_ref;
34931 CHECK((*env)->GetArrayLength(env, val) == 32);
34932 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34933 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
34936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34937 LDKAnnouncementSignatures this_ptr_conv;
34938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34939 this_ptr_conv.is_owned = false;
34940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34941 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
34945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34946 LDKAnnouncementSignatures this_ptr_conv;
34947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34948 this_ptr_conv.is_owned = false;
34949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34950 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
34953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34954 LDKAnnouncementSignatures this_ptr_conv;
34955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34956 this_ptr_conv.is_owned = false;
34957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34958 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34959 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
34963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34964 LDKAnnouncementSignatures this_ptr_conv;
34965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34966 this_ptr_conv.is_owned = false;
34967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34968 LDKSignature val_ref;
34969 CHECK((*env)->GetArrayLength(env, val) == 64);
34970 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34971 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
34974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34975 LDKAnnouncementSignatures this_ptr_conv;
34976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34977 this_ptr_conv.is_owned = false;
34978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34979 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34980 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
34984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34985 LDKAnnouncementSignatures this_ptr_conv;
34986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34987 this_ptr_conv.is_owned = false;
34988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34989 LDKSignature val_ref;
34990 CHECK((*env)->GetArrayLength(env, val) == 64);
34991 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34992 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
34995 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) {
34996 LDKThirtyTwoBytes channel_id_arg_ref;
34997 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34998 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34999 LDKSignature node_signature_arg_ref;
35000 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
35001 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
35002 LDKSignature bitcoin_signature_arg_ref;
35003 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
35004 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
35005 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
35006 int64_t ret_ref = 0;
35007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35010 ret_ref = (uintptr_t)ret_var.inner;
35011 if (ret_var.is_owned) {
35017 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
35018 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
35019 int64_t ret_ref = 0;
35020 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35021 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35023 ret_ref = (uintptr_t)ret_var.inner;
35024 if (ret_var.is_owned) {
35029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35030 LDKAnnouncementSignatures arg_conv;
35031 arg_conv.inner = (void*)(arg & (~1));
35032 arg_conv.is_owned = false;
35033 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35034 int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
35038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35039 LDKAnnouncementSignatures orig_conv;
35040 orig_conv.inner = (void*)(orig & (~1));
35041 orig_conv.is_owned = false;
35042 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35043 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
35044 int64_t ret_ref = 0;
35045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35048 ret_ref = (uintptr_t)ret_var.inner;
35049 if (ret_var.is_owned) {
35055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35056 if ((this_ptr & 1) != 0) return;
35057 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35058 CHECK_ACCESS(this_ptr_ptr);
35059 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
35060 FREE((void*)this_ptr);
35061 NetAddress_free(this_ptr_conv);
35064 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
35065 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35066 *ret_copy = NetAddress_clone(arg);
35067 int64_t ret_ref = (uintptr_t)ret_copy;
35070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35071 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
35072 int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
35076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35077 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
35078 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35079 *ret_copy = NetAddress_clone(orig_conv);
35080 int64_t ret_ref = (uintptr_t)ret_copy;
35084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
35085 LDKFourBytes addr_ref;
35086 CHECK((*env)->GetArrayLength(env, addr) == 4);
35087 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
35088 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35089 *ret_copy = NetAddress_ipv4(addr_ref, port);
35090 int64_t ret_ref = (uintptr_t)ret_copy;
35094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
35095 LDKSixteenBytes addr_ref;
35096 CHECK((*env)->GetArrayLength(env, addr) == 16);
35097 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
35098 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35099 *ret_copy = NetAddress_ipv6(addr_ref, port);
35100 int64_t ret_ref = (uintptr_t)ret_copy;
35104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
35105 LDKTwelveBytes a_ref;
35106 CHECK((*env)->GetArrayLength(env, a) == 12);
35107 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
35108 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35109 *ret_copy = NetAddress_onion_v2(a_ref);
35110 int64_t ret_ref = (uintptr_t)ret_copy;
35114 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) {
35115 LDKThirtyTwoBytes ed25519_pubkey_ref;
35116 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
35117 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
35118 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35119 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
35120 int64_t ret_ref = (uintptr_t)ret_copy;
35124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
35125 LDKHostname hostname_conv;
35126 hostname_conv.inner = (void*)(hostname & (~1));
35127 hostname_conv.is_owned = (hostname & 1) || (hostname == 0);
35128 CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
35129 hostname_conv = Hostname_clone(&hostname_conv);
35130 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35131 *ret_copy = NetAddress_hostname(hostname_conv, port);
35132 int64_t ret_ref = (uintptr_t)ret_copy;
35136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
35137 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
35138 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
35139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35141 CVec_u8Z_free(ret_var);
35145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35146 LDKu8slice ser_ref;
35147 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35148 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35149 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
35150 *ret_conv = NetAddress_read(ser_ref);
35151 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35152 return (int64_t)ret_conv;
35155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35156 LDKUnsignedNodeAnnouncement this_obj_conv;
35157 this_obj_conv.inner = (void*)(this_obj & (~1));
35158 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35160 UnsignedNodeAnnouncement_free(this_obj_conv);
35163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
35164 LDKUnsignedNodeAnnouncement this_ptr_conv;
35165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35166 this_ptr_conv.is_owned = false;
35167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35168 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
35169 int64_t ret_ref = 0;
35170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35173 ret_ref = (uintptr_t)ret_var.inner;
35174 if (ret_var.is_owned) {
35180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35181 LDKUnsignedNodeAnnouncement 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 LDKNodeFeatures val_conv;
35186 val_conv.inner = (void*)(val & (~1));
35187 val_conv.is_owned = (val & 1) || (val == 0);
35188 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35189 val_conv = NodeFeatures_clone(&val_conv);
35190 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
35193 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35194 LDKUnsignedNodeAnnouncement this_ptr_conv;
35195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35196 this_ptr_conv.is_owned = false;
35197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35198 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
35202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35203 LDKUnsignedNodeAnnouncement this_ptr_conv;
35204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35205 this_ptr_conv.is_owned = false;
35206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35207 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
35210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35211 LDKUnsignedNodeAnnouncement this_ptr_conv;
35212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35213 this_ptr_conv.is_owned = false;
35214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35215 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35216 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
35220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35221 LDKUnsignedNodeAnnouncement this_ptr_conv;
35222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35223 this_ptr_conv.is_owned = false;
35224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35225 LDKPublicKey val_ref;
35226 CHECK((*env)->GetArrayLength(env, val) == 33);
35227 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35228 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
35231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
35232 LDKUnsignedNodeAnnouncement this_ptr_conv;
35233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35234 this_ptr_conv.is_owned = false;
35235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35236 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
35237 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
35241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35242 LDKUnsignedNodeAnnouncement this_ptr_conv;
35243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35244 this_ptr_conv.is_owned = false;
35245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35246 LDKThreeBytes val_ref;
35247 CHECK((*env)->GetArrayLength(env, val) == 3);
35248 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
35249 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
35252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
35253 LDKUnsignedNodeAnnouncement this_ptr_conv;
35254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35255 this_ptr_conv.is_owned = false;
35256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35257 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35258 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
35262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35263 LDKUnsignedNodeAnnouncement this_ptr_conv;
35264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35265 this_ptr_conv.is_owned = false;
35266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35267 LDKThirtyTwoBytes val_ref;
35268 CHECK((*env)->GetArrayLength(env, val) == 32);
35269 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35270 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
35273 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
35274 LDKUnsignedNodeAnnouncement this_ptr_conv;
35275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35276 this_ptr_conv.is_owned = false;
35277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35278 LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
35279 int64_tArray ret_arr = NULL;
35280 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35281 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35282 for (size_t m = 0; m < ret_var.datalen; m++) {
35283 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35284 *ret_conv_12_copy = ret_var.data[m];
35285 int64_t ret_conv_12_ref = (uintptr_t)ret_conv_12_copy;
35286 ret_arr_ptr[m] = ret_conv_12_ref;
35288 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35289 FREE(ret_var.data);
35293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35294 LDKUnsignedNodeAnnouncement this_ptr_conv;
35295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35296 this_ptr_conv.is_owned = false;
35297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35298 LDKCVec_NetAddressZ val_constr;
35299 val_constr.datalen = (*env)->GetArrayLength(env, val);
35300 if (val_constr.datalen > 0)
35301 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
35303 val_constr.data = NULL;
35304 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35305 for (size_t m = 0; m < val_constr.datalen; m++) {
35306 int64_t val_conv_12 = val_vals[m];
35307 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
35308 CHECK_ACCESS(val_conv_12_ptr);
35309 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
35310 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
35311 val_constr.data[m] = val_conv_12_conv;
35313 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35314 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
35317 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
35318 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
35319 int64_t ret_ref = 0;
35320 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35321 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35323 ret_ref = (uintptr_t)ret_var.inner;
35324 if (ret_var.is_owned) {
35329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35330 LDKUnsignedNodeAnnouncement arg_conv;
35331 arg_conv.inner = (void*)(arg & (~1));
35332 arg_conv.is_owned = false;
35333 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35334 int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
35338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35339 LDKUnsignedNodeAnnouncement orig_conv;
35340 orig_conv.inner = (void*)(orig & (~1));
35341 orig_conv.is_owned = false;
35342 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35343 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
35344 int64_t ret_ref = 0;
35345 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35346 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35348 ret_ref = (uintptr_t)ret_var.inner;
35349 if (ret_var.is_owned) {
35355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35356 LDKNodeAnnouncement this_obj_conv;
35357 this_obj_conv.inner = (void*)(this_obj & (~1));
35358 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35360 NodeAnnouncement_free(this_obj_conv);
35363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
35364 LDKNodeAnnouncement this_ptr_conv;
35365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35366 this_ptr_conv.is_owned = false;
35367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35368 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35369 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
35373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35374 LDKNodeAnnouncement this_ptr_conv;
35375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35376 this_ptr_conv.is_owned = false;
35377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35378 LDKSignature val_ref;
35379 CHECK((*env)->GetArrayLength(env, val) == 64);
35380 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35381 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
35384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
35385 LDKNodeAnnouncement this_ptr_conv;
35386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35387 this_ptr_conv.is_owned = false;
35388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35389 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
35390 int64_t ret_ref = 0;
35391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35394 ret_ref = (uintptr_t)ret_var.inner;
35395 if (ret_var.is_owned) {
35401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35402 LDKNodeAnnouncement this_ptr_conv;
35403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35404 this_ptr_conv.is_owned = false;
35405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35406 LDKUnsignedNodeAnnouncement val_conv;
35407 val_conv.inner = (void*)(val & (~1));
35408 val_conv.is_owned = (val & 1) || (val == 0);
35409 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35410 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
35411 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
35414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
35415 LDKSignature signature_arg_ref;
35416 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
35417 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
35418 LDKUnsignedNodeAnnouncement contents_arg_conv;
35419 contents_arg_conv.inner = (void*)(contents_arg & (~1));
35420 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
35421 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35422 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
35423 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
35424 int64_t ret_ref = 0;
35425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35428 ret_ref = (uintptr_t)ret_var.inner;
35429 if (ret_var.is_owned) {
35435 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
35436 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
35437 int64_t ret_ref = 0;
35438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35441 ret_ref = (uintptr_t)ret_var.inner;
35442 if (ret_var.is_owned) {
35447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35448 LDKNodeAnnouncement arg_conv;
35449 arg_conv.inner = (void*)(arg & (~1));
35450 arg_conv.is_owned = false;
35451 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35452 int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
35456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35457 LDKNodeAnnouncement orig_conv;
35458 orig_conv.inner = (void*)(orig & (~1));
35459 orig_conv.is_owned = false;
35460 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35461 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
35462 int64_t ret_ref = 0;
35463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35466 ret_ref = (uintptr_t)ret_var.inner;
35467 if (ret_var.is_owned) {
35473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35474 LDKUnsignedChannelAnnouncement this_obj_conv;
35475 this_obj_conv.inner = (void*)(this_obj & (~1));
35476 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35478 UnsignedChannelAnnouncement_free(this_obj_conv);
35481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
35482 LDKUnsignedChannelAnnouncement this_ptr_conv;
35483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35484 this_ptr_conv.is_owned = false;
35485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35486 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
35487 int64_t ret_ref = 0;
35488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35491 ret_ref = (uintptr_t)ret_var.inner;
35492 if (ret_var.is_owned) {
35498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35499 LDKUnsignedChannelAnnouncement this_ptr_conv;
35500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35501 this_ptr_conv.is_owned = false;
35502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35503 LDKChannelFeatures val_conv;
35504 val_conv.inner = (void*)(val & (~1));
35505 val_conv.is_owned = (val & 1) || (val == 0);
35506 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35507 val_conv = ChannelFeatures_clone(&val_conv);
35508 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
35511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35512 LDKUnsignedChannelAnnouncement this_ptr_conv;
35513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35514 this_ptr_conv.is_owned = false;
35515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35516 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35517 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
35521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35522 LDKUnsignedChannelAnnouncement this_ptr_conv;
35523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35524 this_ptr_conv.is_owned = false;
35525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35526 LDKThirtyTwoBytes val_ref;
35527 CHECK((*env)->GetArrayLength(env, val) == 32);
35528 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35529 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
35532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35533 LDKUnsignedChannelAnnouncement this_ptr_conv;
35534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35535 this_ptr_conv.is_owned = false;
35536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35537 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
35541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35542 LDKUnsignedChannelAnnouncement this_ptr_conv;
35543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35544 this_ptr_conv.is_owned = false;
35545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35546 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
35549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35550 LDKUnsignedChannelAnnouncement this_ptr_conv;
35551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35552 this_ptr_conv.is_owned = false;
35553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35554 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35555 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
35559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35560 LDKUnsignedChannelAnnouncement this_ptr_conv;
35561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35562 this_ptr_conv.is_owned = false;
35563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35564 LDKPublicKey val_ref;
35565 CHECK((*env)->GetArrayLength(env, val) == 33);
35566 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35567 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
35570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35571 LDKUnsignedChannelAnnouncement this_ptr_conv;
35572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35573 this_ptr_conv.is_owned = false;
35574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35575 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35576 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
35580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35581 LDKUnsignedChannelAnnouncement this_ptr_conv;
35582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35583 this_ptr_conv.is_owned = false;
35584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35585 LDKPublicKey val_ref;
35586 CHECK((*env)->GetArrayLength(env, val) == 33);
35587 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35588 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
35591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35592 LDKUnsignedChannelAnnouncement this_ptr_conv;
35593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35594 this_ptr_conv.is_owned = false;
35595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35596 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35597 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
35601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35602 LDKUnsignedChannelAnnouncement this_ptr_conv;
35603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35604 this_ptr_conv.is_owned = false;
35605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35606 LDKPublicKey val_ref;
35607 CHECK((*env)->GetArrayLength(env, val) == 33);
35608 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35609 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
35612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35613 LDKUnsignedChannelAnnouncement this_ptr_conv;
35614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35615 this_ptr_conv.is_owned = false;
35616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35617 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35618 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
35622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35623 LDKUnsignedChannelAnnouncement this_ptr_conv;
35624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35625 this_ptr_conv.is_owned = false;
35626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35627 LDKPublicKey val_ref;
35628 CHECK((*env)->GetArrayLength(env, val) == 33);
35629 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35630 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
35633 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
35634 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
35635 int64_t ret_ref = 0;
35636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35639 ret_ref = (uintptr_t)ret_var.inner;
35640 if (ret_var.is_owned) {
35645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35646 LDKUnsignedChannelAnnouncement arg_conv;
35647 arg_conv.inner = (void*)(arg & (~1));
35648 arg_conv.is_owned = false;
35649 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35650 int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
35654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35655 LDKUnsignedChannelAnnouncement orig_conv;
35656 orig_conv.inner = (void*)(orig & (~1));
35657 orig_conv.is_owned = false;
35658 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35659 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
35660 int64_t ret_ref = 0;
35661 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35662 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35664 ret_ref = (uintptr_t)ret_var.inner;
35665 if (ret_var.is_owned) {
35671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35672 LDKChannelAnnouncement this_obj_conv;
35673 this_obj_conv.inner = (void*)(this_obj & (~1));
35674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35676 ChannelAnnouncement_free(this_obj_conv);
35679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35680 LDKChannelAnnouncement this_ptr_conv;
35681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35682 this_ptr_conv.is_owned = false;
35683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35684 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35685 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
35689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35690 LDKChannelAnnouncement this_ptr_conv;
35691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35692 this_ptr_conv.is_owned = false;
35693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35694 LDKSignature val_ref;
35695 CHECK((*env)->GetArrayLength(env, val) == 64);
35696 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35697 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
35700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35701 LDKChannelAnnouncement this_ptr_conv;
35702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35703 this_ptr_conv.is_owned = false;
35704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35705 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
35710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35711 LDKChannelAnnouncement this_ptr_conv;
35712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35713 this_ptr_conv.is_owned = false;
35714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35715 LDKSignature val_ref;
35716 CHECK((*env)->GetArrayLength(env, val) == 64);
35717 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35718 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
35721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35722 LDKChannelAnnouncement this_ptr_conv;
35723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35724 this_ptr_conv.is_owned = false;
35725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35726 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35727 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
35731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35732 LDKChannelAnnouncement this_ptr_conv;
35733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35734 this_ptr_conv.is_owned = false;
35735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35736 LDKSignature val_ref;
35737 CHECK((*env)->GetArrayLength(env, val) == 64);
35738 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35739 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
35742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35743 LDKChannelAnnouncement this_ptr_conv;
35744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35745 this_ptr_conv.is_owned = false;
35746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35747 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35748 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
35752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35753 LDKChannelAnnouncement this_ptr_conv;
35754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35755 this_ptr_conv.is_owned = false;
35756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35757 LDKSignature val_ref;
35758 CHECK((*env)->GetArrayLength(env, val) == 64);
35759 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35760 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
35763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
35764 LDKChannelAnnouncement this_ptr_conv;
35765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35766 this_ptr_conv.is_owned = false;
35767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35768 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
35769 int64_t ret_ref = 0;
35770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35773 ret_ref = (uintptr_t)ret_var.inner;
35774 if (ret_var.is_owned) {
35780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35781 LDKChannelAnnouncement this_ptr_conv;
35782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35783 this_ptr_conv.is_owned = false;
35784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35785 LDKUnsignedChannelAnnouncement val_conv;
35786 val_conv.inner = (void*)(val & (~1));
35787 val_conv.is_owned = (val & 1) || (val == 0);
35788 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35789 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
35790 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
35793 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) {
35794 LDKSignature node_signature_1_arg_ref;
35795 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
35796 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
35797 LDKSignature node_signature_2_arg_ref;
35798 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
35799 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
35800 LDKSignature bitcoin_signature_1_arg_ref;
35801 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
35802 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
35803 LDKSignature bitcoin_signature_2_arg_ref;
35804 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
35805 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
35806 LDKUnsignedChannelAnnouncement contents_arg_conv;
35807 contents_arg_conv.inner = (void*)(contents_arg & (~1));
35808 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
35809 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35810 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
35811 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);
35812 int64_t ret_ref = 0;
35813 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35814 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35816 ret_ref = (uintptr_t)ret_var.inner;
35817 if (ret_var.is_owned) {
35823 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
35824 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
35825 int64_t ret_ref = 0;
35826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35829 ret_ref = (uintptr_t)ret_var.inner;
35830 if (ret_var.is_owned) {
35835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35836 LDKChannelAnnouncement arg_conv;
35837 arg_conv.inner = (void*)(arg & (~1));
35838 arg_conv.is_owned = false;
35839 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35840 int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
35844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35845 LDKChannelAnnouncement orig_conv;
35846 orig_conv.inner = (void*)(orig & (~1));
35847 orig_conv.is_owned = false;
35848 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35849 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
35850 int64_t ret_ref = 0;
35851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35854 ret_ref = (uintptr_t)ret_var.inner;
35855 if (ret_var.is_owned) {
35861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35862 LDKUnsignedChannelUpdate this_obj_conv;
35863 this_obj_conv.inner = (void*)(this_obj & (~1));
35864 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35866 UnsignedChannelUpdate_free(this_obj_conv);
35869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35870 LDKUnsignedChannelUpdate this_ptr_conv;
35871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35872 this_ptr_conv.is_owned = false;
35873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35874 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35875 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
35879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35880 LDKUnsignedChannelUpdate this_ptr_conv;
35881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35882 this_ptr_conv.is_owned = false;
35883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35884 LDKThirtyTwoBytes val_ref;
35885 CHECK((*env)->GetArrayLength(env, val) == 32);
35886 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35887 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
35890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35891 LDKUnsignedChannelUpdate this_ptr_conv;
35892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35893 this_ptr_conv.is_owned = false;
35894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35895 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
35899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35900 LDKUnsignedChannelUpdate this_ptr_conv;
35901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35902 this_ptr_conv.is_owned = false;
35903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35904 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
35907 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35908 LDKUnsignedChannelUpdate this_ptr_conv;
35909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35910 this_ptr_conv.is_owned = false;
35911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35912 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
35916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35917 LDKUnsignedChannelUpdate this_ptr_conv;
35918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35919 this_ptr_conv.is_owned = false;
35920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35921 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
35924 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
35925 LDKUnsignedChannelUpdate this_ptr_conv;
35926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35927 this_ptr_conv.is_owned = false;
35928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35929 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
35933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
35934 LDKUnsignedChannelUpdate this_ptr_conv;
35935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35936 this_ptr_conv.is_owned = false;
35937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35938 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
35941 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
35942 LDKUnsignedChannelUpdate this_ptr_conv;
35943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35944 this_ptr_conv.is_owned = false;
35945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35946 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
35950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35951 LDKUnsignedChannelUpdate this_ptr_conv;
35952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35953 this_ptr_conv.is_owned = false;
35954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35955 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
35958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35959 LDKUnsignedChannelUpdate this_ptr_conv;
35960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35961 this_ptr_conv.is_owned = false;
35962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35963 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
35967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35968 LDKUnsignedChannelUpdate this_ptr_conv;
35969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35970 this_ptr_conv.is_owned = false;
35971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35972 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
35975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35976 LDKUnsignedChannelUpdate this_ptr_conv;
35977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35978 this_ptr_conv.is_owned = false;
35979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35980 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
35984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35985 LDKUnsignedChannelUpdate this_ptr_conv;
35986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35987 this_ptr_conv.is_owned = false;
35988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35989 UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
35992 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35993 LDKUnsignedChannelUpdate this_ptr_conv;
35994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35995 this_ptr_conv.is_owned = false;
35996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35997 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
36001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36002 LDKUnsignedChannelUpdate this_ptr_conv;
36003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36004 this_ptr_conv.is_owned = false;
36005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36006 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
36009 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36010 LDKUnsignedChannelUpdate this_ptr_conv;
36011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36012 this_ptr_conv.is_owned = false;
36013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36014 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
36018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36019 LDKUnsignedChannelUpdate this_ptr_conv;
36020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36021 this_ptr_conv.is_owned = false;
36022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36023 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
36026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
36027 LDKUnsignedChannelUpdate this_ptr_conv;
36028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36029 this_ptr_conv.is_owned = false;
36030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36031 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36039 LDKUnsignedChannelUpdate this_ptr_conv;
36040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36041 this_ptr_conv.is_owned = false;
36042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36043 LDKCVec_u8Z val_ref;
36044 val_ref.datalen = (*env)->GetArrayLength(env, val);
36045 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36046 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
36047 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
36050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) {
36051 LDKThirtyTwoBytes chain_hash_arg_ref;
36052 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36053 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36054 LDKCVec_u8Z excess_data_arg_ref;
36055 excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
36056 excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36057 (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
36058 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref);
36059 int64_t ret_ref = 0;
36060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36063 ret_ref = (uintptr_t)ret_var.inner;
36064 if (ret_var.is_owned) {
36070 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
36071 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
36072 int64_t ret_ref = 0;
36073 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36074 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36076 ret_ref = (uintptr_t)ret_var.inner;
36077 if (ret_var.is_owned) {
36082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36083 LDKUnsignedChannelUpdate arg_conv;
36084 arg_conv.inner = (void*)(arg & (~1));
36085 arg_conv.is_owned = false;
36086 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36087 int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
36091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36092 LDKUnsignedChannelUpdate orig_conv;
36093 orig_conv.inner = (void*)(orig & (~1));
36094 orig_conv.is_owned = false;
36095 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36096 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
36097 int64_t ret_ref = 0;
36098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36101 ret_ref = (uintptr_t)ret_var.inner;
36102 if (ret_var.is_owned) {
36108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36109 LDKChannelUpdate this_obj_conv;
36110 this_obj_conv.inner = (void*)(this_obj & (~1));
36111 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36113 ChannelUpdate_free(this_obj_conv);
36116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
36117 LDKChannelUpdate this_ptr_conv;
36118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36119 this_ptr_conv.is_owned = false;
36120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36121 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36122 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
36126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36127 LDKChannelUpdate this_ptr_conv;
36128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36129 this_ptr_conv.is_owned = false;
36130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36131 LDKSignature val_ref;
36132 CHECK((*env)->GetArrayLength(env, val) == 64);
36133 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36134 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
36137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
36138 LDKChannelUpdate this_ptr_conv;
36139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36140 this_ptr_conv.is_owned = false;
36141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36142 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
36143 int64_t ret_ref = 0;
36144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36147 ret_ref = (uintptr_t)ret_var.inner;
36148 if (ret_var.is_owned) {
36154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36155 LDKChannelUpdate this_ptr_conv;
36156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36157 this_ptr_conv.is_owned = false;
36158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36159 LDKUnsignedChannelUpdate val_conv;
36160 val_conv.inner = (void*)(val & (~1));
36161 val_conv.is_owned = (val & 1) || (val == 0);
36162 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36163 val_conv = UnsignedChannelUpdate_clone(&val_conv);
36164 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
36167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
36168 LDKSignature signature_arg_ref;
36169 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
36170 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
36171 LDKUnsignedChannelUpdate contents_arg_conv;
36172 contents_arg_conv.inner = (void*)(contents_arg & (~1));
36173 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
36174 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
36175 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
36176 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
36177 int64_t ret_ref = 0;
36178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36181 ret_ref = (uintptr_t)ret_var.inner;
36182 if (ret_var.is_owned) {
36188 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
36189 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
36190 int64_t ret_ref = 0;
36191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36194 ret_ref = (uintptr_t)ret_var.inner;
36195 if (ret_var.is_owned) {
36200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36201 LDKChannelUpdate arg_conv;
36202 arg_conv.inner = (void*)(arg & (~1));
36203 arg_conv.is_owned = false;
36204 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36205 int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
36209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36210 LDKChannelUpdate orig_conv;
36211 orig_conv.inner = (void*)(orig & (~1));
36212 orig_conv.is_owned = false;
36213 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36214 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
36215 int64_t ret_ref = 0;
36216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36219 ret_ref = (uintptr_t)ret_var.inner;
36220 if (ret_var.is_owned) {
36226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36227 LDKQueryChannelRange this_obj_conv;
36228 this_obj_conv.inner = (void*)(this_obj & (~1));
36229 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36231 QueryChannelRange_free(this_obj_conv);
36234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36235 LDKQueryChannelRange this_ptr_conv;
36236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36237 this_ptr_conv.is_owned = false;
36238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36239 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36240 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
36244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36245 LDKQueryChannelRange this_ptr_conv;
36246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36247 this_ptr_conv.is_owned = false;
36248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36249 LDKThirtyTwoBytes val_ref;
36250 CHECK((*env)->GetArrayLength(env, val) == 32);
36251 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36252 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
36255 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
36256 LDKQueryChannelRange this_ptr_conv;
36257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36258 this_ptr_conv.is_owned = false;
36259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36260 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
36264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36265 LDKQueryChannelRange this_ptr_conv;
36266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36267 this_ptr_conv.is_owned = false;
36268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36269 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
36272 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
36273 LDKQueryChannelRange this_ptr_conv;
36274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36275 this_ptr_conv.is_owned = false;
36276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36277 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
36281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36282 LDKQueryChannelRange this_ptr_conv;
36283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36284 this_ptr_conv.is_owned = false;
36285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36286 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
36289 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) {
36290 LDKThirtyTwoBytes chain_hash_arg_ref;
36291 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36292 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36293 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
36294 int64_t ret_ref = 0;
36295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36298 ret_ref = (uintptr_t)ret_var.inner;
36299 if (ret_var.is_owned) {
36305 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
36306 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
36307 int64_t ret_ref = 0;
36308 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36309 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36311 ret_ref = (uintptr_t)ret_var.inner;
36312 if (ret_var.is_owned) {
36317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36318 LDKQueryChannelRange arg_conv;
36319 arg_conv.inner = (void*)(arg & (~1));
36320 arg_conv.is_owned = false;
36321 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36322 int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
36326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36327 LDKQueryChannelRange orig_conv;
36328 orig_conv.inner = (void*)(orig & (~1));
36329 orig_conv.is_owned = false;
36330 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36331 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
36332 int64_t ret_ref = 0;
36333 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36334 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36336 ret_ref = (uintptr_t)ret_var.inner;
36337 if (ret_var.is_owned) {
36343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36344 LDKReplyChannelRange this_obj_conv;
36345 this_obj_conv.inner = (void*)(this_obj & (~1));
36346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36348 ReplyChannelRange_free(this_obj_conv);
36351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36352 LDKReplyChannelRange this_ptr_conv;
36353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36354 this_ptr_conv.is_owned = false;
36355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36356 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36357 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
36361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36362 LDKReplyChannelRange this_ptr_conv;
36363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36364 this_ptr_conv.is_owned = false;
36365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36366 LDKThirtyTwoBytes val_ref;
36367 CHECK((*env)->GetArrayLength(env, val) == 32);
36368 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36369 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
36372 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
36373 LDKReplyChannelRange this_ptr_conv;
36374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36375 this_ptr_conv.is_owned = false;
36376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36377 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
36381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36382 LDKReplyChannelRange this_ptr_conv;
36383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36384 this_ptr_conv.is_owned = false;
36385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36386 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
36389 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
36390 LDKReplyChannelRange this_ptr_conv;
36391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36392 this_ptr_conv.is_owned = false;
36393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36394 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
36398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36399 LDKReplyChannelRange this_ptr_conv;
36400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36401 this_ptr_conv.is_owned = false;
36402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36403 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
36406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
36407 LDKReplyChannelRange this_ptr_conv;
36408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36409 this_ptr_conv.is_owned = false;
36410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36411 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
36415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36416 LDKReplyChannelRange this_ptr_conv;
36417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36418 this_ptr_conv.is_owned = false;
36419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36420 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
36423 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
36424 LDKReplyChannelRange this_ptr_conv;
36425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36426 this_ptr_conv.is_owned = false;
36427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36428 LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
36429 int64_tArray ret_arr = NULL;
36430 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36431 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36432 for (size_t g = 0; g < ret_var.datalen; g++) {
36433 int64_t ret_conv_6_conv = ret_var.data[g];
36434 ret_arr_ptr[g] = ret_conv_6_conv;
36436 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36437 FREE(ret_var.data);
36441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36442 LDKReplyChannelRange this_ptr_conv;
36443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36444 this_ptr_conv.is_owned = false;
36445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36446 LDKCVec_u64Z val_constr;
36447 val_constr.datalen = (*env)->GetArrayLength(env, val);
36448 if (val_constr.datalen > 0)
36449 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36451 val_constr.data = NULL;
36452 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36453 for (size_t g = 0; g < val_constr.datalen; g++) {
36454 int64_t val_conv_6 = val_vals[g];
36455 val_constr.data[g] = val_conv_6;
36457 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36458 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
36461 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) {
36462 LDKThirtyTwoBytes chain_hash_arg_ref;
36463 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36464 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36465 LDKCVec_u64Z short_channel_ids_arg_constr;
36466 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
36467 if (short_channel_ids_arg_constr.datalen > 0)
36468 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36470 short_channel_ids_arg_constr.data = NULL;
36471 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
36472 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
36473 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
36474 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
36476 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
36477 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
36478 int64_t ret_ref = 0;
36479 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36480 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36481 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36482 ret_ref = (uintptr_t)ret_var.inner;
36483 if (ret_var.is_owned) {
36489 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
36490 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
36491 int64_t ret_ref = 0;
36492 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36493 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36495 ret_ref = (uintptr_t)ret_var.inner;
36496 if (ret_var.is_owned) {
36501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36502 LDKReplyChannelRange arg_conv;
36503 arg_conv.inner = (void*)(arg & (~1));
36504 arg_conv.is_owned = false;
36505 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36506 int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
36510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36511 LDKReplyChannelRange orig_conv;
36512 orig_conv.inner = (void*)(orig & (~1));
36513 orig_conv.is_owned = false;
36514 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36515 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
36516 int64_t ret_ref = 0;
36517 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36518 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36520 ret_ref = (uintptr_t)ret_var.inner;
36521 if (ret_var.is_owned) {
36527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36528 LDKQueryShortChannelIds this_obj_conv;
36529 this_obj_conv.inner = (void*)(this_obj & (~1));
36530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36532 QueryShortChannelIds_free(this_obj_conv);
36535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36536 LDKQueryShortChannelIds this_ptr_conv;
36537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36538 this_ptr_conv.is_owned = false;
36539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36540 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36541 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
36545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36546 LDKQueryShortChannelIds this_ptr_conv;
36547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36548 this_ptr_conv.is_owned = false;
36549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36550 LDKThirtyTwoBytes val_ref;
36551 CHECK((*env)->GetArrayLength(env, val) == 32);
36552 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36553 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
36556 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
36557 LDKQueryShortChannelIds this_ptr_conv;
36558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36559 this_ptr_conv.is_owned = false;
36560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36561 LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
36562 int64_tArray ret_arr = NULL;
36563 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36564 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36565 for (size_t g = 0; g < ret_var.datalen; g++) {
36566 int64_t ret_conv_6_conv = ret_var.data[g];
36567 ret_arr_ptr[g] = ret_conv_6_conv;
36569 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36570 FREE(ret_var.data);
36574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36575 LDKQueryShortChannelIds this_ptr_conv;
36576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36577 this_ptr_conv.is_owned = false;
36578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36579 LDKCVec_u64Z val_constr;
36580 val_constr.datalen = (*env)->GetArrayLength(env, val);
36581 if (val_constr.datalen > 0)
36582 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36584 val_constr.data = NULL;
36585 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36586 for (size_t g = 0; g < val_constr.datalen; g++) {
36587 int64_t val_conv_6 = val_vals[g];
36588 val_constr.data[g] = val_conv_6;
36590 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36591 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
36594 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) {
36595 LDKThirtyTwoBytes chain_hash_arg_ref;
36596 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36597 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36598 LDKCVec_u64Z short_channel_ids_arg_constr;
36599 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
36600 if (short_channel_ids_arg_constr.datalen > 0)
36601 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36603 short_channel_ids_arg_constr.data = NULL;
36604 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
36605 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
36606 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
36607 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
36609 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
36610 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
36611 int64_t ret_ref = 0;
36612 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36613 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36615 ret_ref = (uintptr_t)ret_var.inner;
36616 if (ret_var.is_owned) {
36622 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
36623 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
36624 int64_t ret_ref = 0;
36625 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36626 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36628 ret_ref = (uintptr_t)ret_var.inner;
36629 if (ret_var.is_owned) {
36634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36635 LDKQueryShortChannelIds arg_conv;
36636 arg_conv.inner = (void*)(arg & (~1));
36637 arg_conv.is_owned = false;
36638 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36639 int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
36643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36644 LDKQueryShortChannelIds orig_conv;
36645 orig_conv.inner = (void*)(orig & (~1));
36646 orig_conv.is_owned = false;
36647 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36648 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
36649 int64_t ret_ref = 0;
36650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36653 ret_ref = (uintptr_t)ret_var.inner;
36654 if (ret_var.is_owned) {
36660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36661 LDKReplyShortChannelIdsEnd this_obj_conv;
36662 this_obj_conv.inner = (void*)(this_obj & (~1));
36663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36665 ReplyShortChannelIdsEnd_free(this_obj_conv);
36668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36669 LDKReplyShortChannelIdsEnd this_ptr_conv;
36670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36671 this_ptr_conv.is_owned = false;
36672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36673 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36674 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
36678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36679 LDKReplyShortChannelIdsEnd this_ptr_conv;
36680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36681 this_ptr_conv.is_owned = false;
36682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36683 LDKThirtyTwoBytes val_ref;
36684 CHECK((*env)->GetArrayLength(env, val) == 32);
36685 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36686 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
36689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
36690 LDKReplyShortChannelIdsEnd this_ptr_conv;
36691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36692 this_ptr_conv.is_owned = false;
36693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36694 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
36698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36699 LDKReplyShortChannelIdsEnd this_ptr_conv;
36700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36701 this_ptr_conv.is_owned = false;
36702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36703 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
36706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
36707 LDKThirtyTwoBytes chain_hash_arg_ref;
36708 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36709 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36710 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
36711 int64_t ret_ref = 0;
36712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36715 ret_ref = (uintptr_t)ret_var.inner;
36716 if (ret_var.is_owned) {
36722 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
36723 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
36724 int64_t ret_ref = 0;
36725 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36726 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36728 ret_ref = (uintptr_t)ret_var.inner;
36729 if (ret_var.is_owned) {
36734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36735 LDKReplyShortChannelIdsEnd arg_conv;
36736 arg_conv.inner = (void*)(arg & (~1));
36737 arg_conv.is_owned = false;
36738 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36739 int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
36743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36744 LDKReplyShortChannelIdsEnd orig_conv;
36745 orig_conv.inner = (void*)(orig & (~1));
36746 orig_conv.is_owned = false;
36747 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36748 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
36749 int64_t ret_ref = 0;
36750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36753 ret_ref = (uintptr_t)ret_var.inner;
36754 if (ret_var.is_owned) {
36760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36761 LDKGossipTimestampFilter this_obj_conv;
36762 this_obj_conv.inner = (void*)(this_obj & (~1));
36763 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36765 GossipTimestampFilter_free(this_obj_conv);
36768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36769 LDKGossipTimestampFilter this_ptr_conv;
36770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36771 this_ptr_conv.is_owned = false;
36772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36773 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36774 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
36778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36779 LDKGossipTimestampFilter this_ptr_conv;
36780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36781 this_ptr_conv.is_owned = false;
36782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36783 LDKThirtyTwoBytes val_ref;
36784 CHECK((*env)->GetArrayLength(env, val) == 32);
36785 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36786 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
36789 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
36790 LDKGossipTimestampFilter this_ptr_conv;
36791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36792 this_ptr_conv.is_owned = false;
36793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36794 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
36798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36799 LDKGossipTimestampFilter this_ptr_conv;
36800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36801 this_ptr_conv.is_owned = false;
36802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36803 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
36806 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
36807 LDKGossipTimestampFilter this_ptr_conv;
36808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36809 this_ptr_conv.is_owned = false;
36810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36811 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
36815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36816 LDKGossipTimestampFilter this_ptr_conv;
36817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36818 this_ptr_conv.is_owned = false;
36819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36820 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
36823 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) {
36824 LDKThirtyTwoBytes chain_hash_arg_ref;
36825 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36826 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36827 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
36828 int64_t ret_ref = 0;
36829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36832 ret_ref = (uintptr_t)ret_var.inner;
36833 if (ret_var.is_owned) {
36839 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
36840 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
36841 int64_t ret_ref = 0;
36842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36845 ret_ref = (uintptr_t)ret_var.inner;
36846 if (ret_var.is_owned) {
36851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36852 LDKGossipTimestampFilter arg_conv;
36853 arg_conv.inner = (void*)(arg & (~1));
36854 arg_conv.is_owned = false;
36855 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36856 int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
36860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36861 LDKGossipTimestampFilter orig_conv;
36862 orig_conv.inner = (void*)(orig & (~1));
36863 orig_conv.is_owned = false;
36864 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36865 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
36866 int64_t ret_ref = 0;
36867 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36868 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36870 ret_ref = (uintptr_t)ret_var.inner;
36871 if (ret_var.is_owned) {
36877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36878 if ((this_ptr & 1) != 0) return;
36879 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36880 CHECK_ACCESS(this_ptr_ptr);
36881 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
36882 FREE((void*)this_ptr);
36883 ErrorAction_free(this_ptr_conv);
36886 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
36887 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36888 *ret_copy = ErrorAction_clone(arg);
36889 int64_t ret_ref = (uintptr_t)ret_copy;
36892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36893 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
36894 int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
36898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36899 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
36900 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36901 *ret_copy = ErrorAction_clone(orig_conv);
36902 int64_t ret_ref = (uintptr_t)ret_copy;
36906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
36907 LDKErrorMessage msg_conv;
36908 msg_conv.inner = (void*)(msg & (~1));
36909 msg_conv.is_owned = (msg & 1) || (msg == 0);
36910 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36911 msg_conv = ErrorMessage_clone(&msg_conv);
36912 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36913 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
36914 int64_t ret_ref = (uintptr_t)ret_copy;
36918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
36919 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36920 *ret_copy = ErrorAction_ignore_error();
36921 int64_t ret_ref = (uintptr_t)ret_copy;
36925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
36926 LDKLevel a_conv = LDKLevel_from_java(env, a);
36927 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36928 *ret_copy = ErrorAction_ignore_and_log(a_conv);
36929 int64_t ret_ref = (uintptr_t)ret_copy;
36933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
36934 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36935 *ret_copy = ErrorAction_ignore_duplicate_gossip();
36936 int64_t ret_ref = (uintptr_t)ret_copy;
36940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
36941 LDKErrorMessage msg_conv;
36942 msg_conv.inner = (void*)(msg & (~1));
36943 msg_conv.is_owned = (msg & 1) || (msg == 0);
36944 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36945 msg_conv = ErrorMessage_clone(&msg_conv);
36946 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36947 *ret_copy = ErrorAction_send_error_message(msg_conv);
36948 int64_t ret_ref = (uintptr_t)ret_copy;
36952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
36953 LDKWarningMessage msg_conv;
36954 msg_conv.inner = (void*)(msg & (~1));
36955 msg_conv.is_owned = (msg & 1) || (msg == 0);
36956 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36957 msg_conv = WarningMessage_clone(&msg_conv);
36958 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
36959 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36960 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
36961 int64_t ret_ref = (uintptr_t)ret_copy;
36965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36966 LDKLightningError this_obj_conv;
36967 this_obj_conv.inner = (void*)(this_obj & (~1));
36968 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36970 LightningError_free(this_obj_conv);
36973 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
36974 LDKLightningError this_ptr_conv;
36975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36976 this_ptr_conv.is_owned = false;
36977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36978 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
36979 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
36984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
36985 LDKLightningError this_ptr_conv;
36986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36987 this_ptr_conv.is_owned = false;
36988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36989 LDKStr val_conv = java_to_owned_str(env, val);
36990 LightningError_set_err(&this_ptr_conv, val_conv);
36993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
36994 LDKLightningError this_ptr_conv;
36995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36996 this_ptr_conv.is_owned = false;
36997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36998 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
36999 *ret_copy = LightningError_get_action(&this_ptr_conv);
37000 int64_t ret_ref = (uintptr_t)ret_copy;
37004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37005 LDKLightningError 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37010 CHECK_ACCESS(val_ptr);
37011 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
37012 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
37013 LightningError_set_action(&this_ptr_conv, val_conv);
37016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
37017 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
37018 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
37019 CHECK_ACCESS(action_arg_ptr);
37020 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
37021 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
37022 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
37023 int64_t ret_ref = 0;
37024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37027 ret_ref = (uintptr_t)ret_var.inner;
37028 if (ret_var.is_owned) {
37034 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
37035 LDKLightningError ret_var = LightningError_clone(arg);
37036 int64_t ret_ref = 0;
37037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37040 ret_ref = (uintptr_t)ret_var.inner;
37041 if (ret_var.is_owned) {
37046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37047 LDKLightningError arg_conv;
37048 arg_conv.inner = (void*)(arg & (~1));
37049 arg_conv.is_owned = false;
37050 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37051 int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
37055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37056 LDKLightningError orig_conv;
37057 orig_conv.inner = (void*)(orig & (~1));
37058 orig_conv.is_owned = false;
37059 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37060 LDKLightningError ret_var = LightningError_clone(&orig_conv);
37061 int64_t ret_ref = 0;
37062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37065 ret_ref = (uintptr_t)ret_var.inner;
37066 if (ret_var.is_owned) {
37072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37073 LDKCommitmentUpdate this_obj_conv;
37074 this_obj_conv.inner = (void*)(this_obj & (~1));
37075 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37077 CommitmentUpdate_free(this_obj_conv);
37080 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37081 LDKCommitmentUpdate this_ptr_conv;
37082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37083 this_ptr_conv.is_owned = false;
37084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37085 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
37086 int64_tArray ret_arr = NULL;
37087 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37088 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37089 for (size_t p = 0; p < ret_var.datalen; p++) {
37090 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
37091 int64_t ret_conv_15_ref = 0;
37092 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37093 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
37095 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
37096 if (ret_conv_15_var.is_owned) {
37097 ret_conv_15_ref |= 1;
37099 ret_arr_ptr[p] = ret_conv_15_ref;
37101 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37102 FREE(ret_var.data);
37106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37107 LDKCommitmentUpdate this_ptr_conv;
37108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37109 this_ptr_conv.is_owned = false;
37110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37111 LDKCVec_UpdateAddHTLCZ val_constr;
37112 val_constr.datalen = (*env)->GetArrayLength(env, val);
37113 if (val_constr.datalen > 0)
37114 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
37116 val_constr.data = NULL;
37117 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37118 for (size_t p = 0; p < val_constr.datalen; p++) {
37119 int64_t val_conv_15 = val_vals[p];
37120 LDKUpdateAddHTLC val_conv_15_conv;
37121 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
37122 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
37123 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
37124 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
37125 val_constr.data[p] = val_conv_15_conv;
37127 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37128 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
37131 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37132 LDKCommitmentUpdate this_ptr_conv;
37133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37134 this_ptr_conv.is_owned = false;
37135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37136 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
37137 int64_tArray ret_arr = NULL;
37138 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37139 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37140 for (size_t t = 0; t < ret_var.datalen; t++) {
37141 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
37142 int64_t ret_conv_19_ref = 0;
37143 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37144 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
37146 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
37147 if (ret_conv_19_var.is_owned) {
37148 ret_conv_19_ref |= 1;
37150 ret_arr_ptr[t] = ret_conv_19_ref;
37152 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37153 FREE(ret_var.data);
37157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37158 LDKCommitmentUpdate this_ptr_conv;
37159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37160 this_ptr_conv.is_owned = false;
37161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37162 LDKCVec_UpdateFulfillHTLCZ val_constr;
37163 val_constr.datalen = (*env)->GetArrayLength(env, val);
37164 if (val_constr.datalen > 0)
37165 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
37167 val_constr.data = NULL;
37168 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37169 for (size_t t = 0; t < val_constr.datalen; t++) {
37170 int64_t val_conv_19 = val_vals[t];
37171 LDKUpdateFulfillHTLC val_conv_19_conv;
37172 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
37173 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
37174 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
37175 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
37176 val_constr.data[t] = val_conv_19_conv;
37178 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37179 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
37182 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37183 LDKCommitmentUpdate this_ptr_conv;
37184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37185 this_ptr_conv.is_owned = false;
37186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37187 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
37188 int64_tArray ret_arr = NULL;
37189 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37190 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37191 for (size_t q = 0; q < ret_var.datalen; q++) {
37192 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
37193 int64_t ret_conv_16_ref = 0;
37194 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37195 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
37197 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
37198 if (ret_conv_16_var.is_owned) {
37199 ret_conv_16_ref |= 1;
37201 ret_arr_ptr[q] = ret_conv_16_ref;
37203 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37204 FREE(ret_var.data);
37208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37209 LDKCommitmentUpdate this_ptr_conv;
37210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37211 this_ptr_conv.is_owned = false;
37212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37213 LDKCVec_UpdateFailHTLCZ val_constr;
37214 val_constr.datalen = (*env)->GetArrayLength(env, val);
37215 if (val_constr.datalen > 0)
37216 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
37218 val_constr.data = NULL;
37219 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37220 for (size_t q = 0; q < val_constr.datalen; q++) {
37221 int64_t val_conv_16 = val_vals[q];
37222 LDKUpdateFailHTLC val_conv_16_conv;
37223 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
37224 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
37225 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
37226 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
37227 val_constr.data[q] = val_conv_16_conv;
37229 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37230 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
37233 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37234 LDKCommitmentUpdate this_ptr_conv;
37235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37236 this_ptr_conv.is_owned = false;
37237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37238 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
37239 int64_tArray ret_arr = NULL;
37240 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37241 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37242 for (size_t z = 0; z < ret_var.datalen; z++) {
37243 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
37244 int64_t ret_conv_25_ref = 0;
37245 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37246 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
37248 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
37249 if (ret_conv_25_var.is_owned) {
37250 ret_conv_25_ref |= 1;
37252 ret_arr_ptr[z] = ret_conv_25_ref;
37254 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37255 FREE(ret_var.data);
37259 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) {
37260 LDKCommitmentUpdate this_ptr_conv;
37261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37262 this_ptr_conv.is_owned = false;
37263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37264 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
37265 val_constr.datalen = (*env)->GetArrayLength(env, val);
37266 if (val_constr.datalen > 0)
37267 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
37269 val_constr.data = NULL;
37270 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37271 for (size_t z = 0; z < val_constr.datalen; z++) {
37272 int64_t val_conv_25 = val_vals[z];
37273 LDKUpdateFailMalformedHTLC val_conv_25_conv;
37274 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
37275 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
37276 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
37277 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
37278 val_constr.data[z] = val_conv_25_conv;
37280 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37281 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
37284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
37285 LDKCommitmentUpdate this_ptr_conv;
37286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37287 this_ptr_conv.is_owned = false;
37288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37289 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
37290 int64_t ret_ref = 0;
37291 if ((uintptr_t)ret_var.inner > 4096) {
37292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37295 ret_ref = (uintptr_t)ret_var.inner;
37296 if (ret_var.is_owned) {
37303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37304 LDKCommitmentUpdate this_ptr_conv;
37305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37306 this_ptr_conv.is_owned = false;
37307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37308 LDKUpdateFee val_conv;
37309 val_conv.inner = (void*)(val & (~1));
37310 val_conv.is_owned = (val & 1) || (val == 0);
37311 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37312 val_conv = UpdateFee_clone(&val_conv);
37313 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
37316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
37317 LDKCommitmentUpdate this_ptr_conv;
37318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37319 this_ptr_conv.is_owned = false;
37320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37321 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
37322 int64_t ret_ref = 0;
37323 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37324 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37325 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37326 ret_ref = (uintptr_t)ret_var.inner;
37327 if (ret_var.is_owned) {
37333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37334 LDKCommitmentUpdate this_ptr_conv;
37335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37336 this_ptr_conv.is_owned = false;
37337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37338 LDKCommitmentSigned val_conv;
37339 val_conv.inner = (void*)(val & (~1));
37340 val_conv.is_owned = (val & 1) || (val == 0);
37341 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37342 val_conv = CommitmentSigned_clone(&val_conv);
37343 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
37346 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) {
37347 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
37348 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
37349 if (update_add_htlcs_arg_constr.datalen > 0)
37350 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
37352 update_add_htlcs_arg_constr.data = NULL;
37353 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
37354 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
37355 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
37356 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
37357 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
37358 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
37359 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
37360 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
37361 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
37363 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
37364 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
37365 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
37366 if (update_fulfill_htlcs_arg_constr.datalen > 0)
37367 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
37369 update_fulfill_htlcs_arg_constr.data = NULL;
37370 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
37371 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
37372 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
37373 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
37374 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
37375 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
37376 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
37377 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
37378 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
37380 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
37381 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
37382 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
37383 if (update_fail_htlcs_arg_constr.datalen > 0)
37384 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
37386 update_fail_htlcs_arg_constr.data = NULL;
37387 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
37388 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
37389 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
37390 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
37391 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
37392 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
37393 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
37394 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
37395 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
37397 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
37398 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
37399 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
37400 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
37401 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
37403 update_fail_malformed_htlcs_arg_constr.data = NULL;
37404 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
37405 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
37406 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
37407 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
37408 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
37409 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);
37410 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
37411 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
37412 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
37414 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
37415 LDKUpdateFee update_fee_arg_conv;
37416 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
37417 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
37418 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
37419 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
37420 LDKCommitmentSigned commitment_signed_arg_conv;
37421 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
37422 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
37423 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
37424 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
37425 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);
37426 int64_t ret_ref = 0;
37427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37430 ret_ref = (uintptr_t)ret_var.inner;
37431 if (ret_var.is_owned) {
37437 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
37438 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
37439 int64_t ret_ref = 0;
37440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37443 ret_ref = (uintptr_t)ret_var.inner;
37444 if (ret_var.is_owned) {
37449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37450 LDKCommitmentUpdate arg_conv;
37451 arg_conv.inner = (void*)(arg & (~1));
37452 arg_conv.is_owned = false;
37453 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37454 int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
37458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37459 LDKCommitmentUpdate orig_conv;
37460 orig_conv.inner = (void*)(orig & (~1));
37461 orig_conv.is_owned = false;
37462 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37463 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
37464 int64_t ret_ref = 0;
37465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37468 ret_ref = (uintptr_t)ret_var.inner;
37469 if (ret_var.is_owned) {
37475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37476 if ((this_ptr & 1) != 0) return;
37477 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37478 CHECK_ACCESS(this_ptr_ptr);
37479 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
37480 FREE((void*)this_ptr);
37481 ChannelMessageHandler_free(this_ptr_conv);
37484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37485 if ((this_ptr & 1) != 0) return;
37486 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37487 CHECK_ACCESS(this_ptr_ptr);
37488 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
37489 FREE((void*)this_ptr);
37490 RoutingMessageHandler_free(this_ptr_conv);
37493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
37494 LDKAcceptChannel obj_conv;
37495 obj_conv.inner = (void*)(obj & (~1));
37496 obj_conv.is_owned = false;
37497 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37498 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
37499 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37500 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37501 CVec_u8Z_free(ret_var);
37505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37506 LDKu8slice ser_ref;
37507 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37508 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37509 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
37510 *ret_conv = AcceptChannel_read(ser_ref);
37511 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37512 return (int64_t)ret_conv;
37515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
37516 LDKAnnouncementSignatures obj_conv;
37517 obj_conv.inner = (void*)(obj & (~1));
37518 obj_conv.is_owned = false;
37519 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37520 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
37521 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37522 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37523 CVec_u8Z_free(ret_var);
37527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37528 LDKu8slice ser_ref;
37529 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37530 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37531 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
37532 *ret_conv = AnnouncementSignatures_read(ser_ref);
37533 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37534 return (int64_t)ret_conv;
37537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
37538 LDKChannelReestablish obj_conv;
37539 obj_conv.inner = (void*)(obj & (~1));
37540 obj_conv.is_owned = false;
37541 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37542 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
37543 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37544 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37545 CVec_u8Z_free(ret_var);
37549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37550 LDKu8slice ser_ref;
37551 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37552 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37553 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
37554 *ret_conv = ChannelReestablish_read(ser_ref);
37555 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37556 return (int64_t)ret_conv;
37559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37560 LDKClosingSigned obj_conv;
37561 obj_conv.inner = (void*)(obj & (~1));
37562 obj_conv.is_owned = false;
37563 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37564 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
37565 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37566 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37567 CVec_u8Z_free(ret_var);
37571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37572 LDKu8slice ser_ref;
37573 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37574 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37575 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
37576 *ret_conv = ClosingSigned_read(ser_ref);
37577 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37578 return (int64_t)ret_conv;
37581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
37582 LDKClosingSignedFeeRange obj_conv;
37583 obj_conv.inner = (void*)(obj & (~1));
37584 obj_conv.is_owned = false;
37585 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37586 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
37587 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37588 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37589 CVec_u8Z_free(ret_var);
37593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37594 LDKu8slice ser_ref;
37595 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37596 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37597 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
37598 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
37599 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37600 return (int64_t)ret_conv;
37603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37604 LDKCommitmentSigned obj_conv;
37605 obj_conv.inner = (void*)(obj & (~1));
37606 obj_conv.is_owned = false;
37607 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37608 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
37609 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37610 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37611 CVec_u8Z_free(ret_var);
37615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37616 LDKu8slice ser_ref;
37617 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37618 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37619 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
37620 *ret_conv = CommitmentSigned_read(ser_ref);
37621 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37622 return (int64_t)ret_conv;
37625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
37626 LDKFundingCreated obj_conv;
37627 obj_conv.inner = (void*)(obj & (~1));
37628 obj_conv.is_owned = false;
37629 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37630 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
37631 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37632 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37633 CVec_u8Z_free(ret_var);
37637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37638 LDKu8slice ser_ref;
37639 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37640 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37641 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
37642 *ret_conv = FundingCreated_read(ser_ref);
37643 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37644 return (int64_t)ret_conv;
37647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37648 LDKFundingSigned obj_conv;
37649 obj_conv.inner = (void*)(obj & (~1));
37650 obj_conv.is_owned = false;
37651 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37652 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
37653 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37654 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37655 CVec_u8Z_free(ret_var);
37659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37660 LDKu8slice ser_ref;
37661 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37662 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37663 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
37664 *ret_conv = FundingSigned_read(ser_ref);
37665 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37666 return (int64_t)ret_conv;
37669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
37670 LDKChannelReady obj_conv;
37671 obj_conv.inner = (void*)(obj & (~1));
37672 obj_conv.is_owned = false;
37673 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37674 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
37675 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37676 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37677 CVec_u8Z_free(ret_var);
37681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37682 LDKu8slice ser_ref;
37683 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37684 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37685 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
37686 *ret_conv = ChannelReady_read(ser_ref);
37687 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37688 return (int64_t)ret_conv;
37691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
37693 obj_conv.inner = (void*)(obj & (~1));
37694 obj_conv.is_owned = false;
37695 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37696 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
37697 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37698 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37699 CVec_u8Z_free(ret_var);
37703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37704 LDKu8slice ser_ref;
37705 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37706 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37707 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
37708 *ret_conv = Init_read(ser_ref);
37709 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37710 return (int64_t)ret_conv;
37713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
37714 LDKOpenChannel obj_conv;
37715 obj_conv.inner = (void*)(obj & (~1));
37716 obj_conv.is_owned = false;
37717 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37718 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
37719 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37720 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37721 CVec_u8Z_free(ret_var);
37725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37726 LDKu8slice ser_ref;
37727 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37728 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37729 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
37730 *ret_conv = OpenChannel_read(ser_ref);
37731 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37732 return (int64_t)ret_conv;
37735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
37736 LDKRevokeAndACK obj_conv;
37737 obj_conv.inner = (void*)(obj & (~1));
37738 obj_conv.is_owned = false;
37739 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37740 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
37741 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37742 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37743 CVec_u8Z_free(ret_var);
37747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37748 LDKu8slice ser_ref;
37749 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37750 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37751 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
37752 *ret_conv = RevokeAndACK_read(ser_ref);
37753 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37754 return (int64_t)ret_conv;
37757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
37758 LDKShutdown obj_conv;
37759 obj_conv.inner = (void*)(obj & (~1));
37760 obj_conv.is_owned = false;
37761 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37762 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
37763 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37764 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37765 CVec_u8Z_free(ret_var);
37769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37770 LDKu8slice ser_ref;
37771 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37772 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37773 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
37774 *ret_conv = Shutdown_read(ser_ref);
37775 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37776 return (int64_t)ret_conv;
37779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37780 LDKUpdateFailHTLC obj_conv;
37781 obj_conv.inner = (void*)(obj & (~1));
37782 obj_conv.is_owned = false;
37783 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37784 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
37785 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37786 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37787 CVec_u8Z_free(ret_var);
37791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37792 LDKu8slice ser_ref;
37793 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37794 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37795 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
37796 *ret_conv = UpdateFailHTLC_read(ser_ref);
37797 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37798 return (int64_t)ret_conv;
37801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37802 LDKUpdateFailMalformedHTLC obj_conv;
37803 obj_conv.inner = (void*)(obj & (~1));
37804 obj_conv.is_owned = false;
37805 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37806 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
37807 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37808 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37809 CVec_u8Z_free(ret_var);
37813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37814 LDKu8slice ser_ref;
37815 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37816 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37817 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
37818 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
37819 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37820 return (int64_t)ret_conv;
37823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
37824 LDKUpdateFee obj_conv;
37825 obj_conv.inner = (void*)(obj & (~1));
37826 obj_conv.is_owned = false;
37827 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37828 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
37829 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37830 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37831 CVec_u8Z_free(ret_var);
37835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37836 LDKu8slice ser_ref;
37837 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37838 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37839 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
37840 *ret_conv = UpdateFee_read(ser_ref);
37841 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37842 return (int64_t)ret_conv;
37845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37846 LDKUpdateFulfillHTLC obj_conv;
37847 obj_conv.inner = (void*)(obj & (~1));
37848 obj_conv.is_owned = false;
37849 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37850 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
37851 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37852 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37853 CVec_u8Z_free(ret_var);
37857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37858 LDKu8slice ser_ref;
37859 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37860 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37861 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
37862 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
37863 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37864 return (int64_t)ret_conv;
37867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
37868 LDKUpdateAddHTLC obj_conv;
37869 obj_conv.inner = (void*)(obj & (~1));
37870 obj_conv.is_owned = false;
37871 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37872 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
37873 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37874 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37875 CVec_u8Z_free(ret_var);
37879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37880 LDKu8slice ser_ref;
37881 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37882 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37883 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
37884 *ret_conv = UpdateAddHTLC_read(ser_ref);
37885 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37886 return (int64_t)ret_conv;
37889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
37891 obj_conv.inner = (void*)(obj & (~1));
37892 obj_conv.is_owned = false;
37893 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37894 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
37895 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37896 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37897 CVec_u8Z_free(ret_var);
37901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37902 LDKu8slice ser_ref;
37903 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37904 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37905 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
37906 *ret_conv = Ping_read(ser_ref);
37907 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37908 return (int64_t)ret_conv;
37911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
37913 obj_conv.inner = (void*)(obj & (~1));
37914 obj_conv.is_owned = false;
37915 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37916 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
37917 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37918 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37919 CVec_u8Z_free(ret_var);
37923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37924 LDKu8slice ser_ref;
37925 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37926 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37927 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
37928 *ret_conv = Pong_read(ser_ref);
37929 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37930 return (int64_t)ret_conv;
37933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37934 LDKUnsignedChannelAnnouncement obj_conv;
37935 obj_conv.inner = (void*)(obj & (~1));
37936 obj_conv.is_owned = false;
37937 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37938 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
37939 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37940 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37941 CVec_u8Z_free(ret_var);
37945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37946 LDKu8slice ser_ref;
37947 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37948 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37949 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
37950 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
37951 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37952 return (int64_t)ret_conv;
37955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
37956 LDKChannelAnnouncement obj_conv;
37957 obj_conv.inner = (void*)(obj & (~1));
37958 obj_conv.is_owned = false;
37959 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37960 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
37961 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37962 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37963 CVec_u8Z_free(ret_var);
37967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37968 LDKu8slice ser_ref;
37969 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37970 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37971 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
37972 *ret_conv = ChannelAnnouncement_read(ser_ref);
37973 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37974 return (int64_t)ret_conv;
37977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37978 LDKUnsignedChannelUpdate obj_conv;
37979 obj_conv.inner = (void*)(obj & (~1));
37980 obj_conv.is_owned = false;
37981 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37982 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
37983 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37984 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37985 CVec_u8Z_free(ret_var);
37989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37990 LDKu8slice ser_ref;
37991 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37992 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37993 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
37994 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
37995 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37996 return (int64_t)ret_conv;
37999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38000 LDKChannelUpdate obj_conv;
38001 obj_conv.inner = (void*)(obj & (~1));
38002 obj_conv.is_owned = false;
38003 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38004 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
38005 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38006 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38007 CVec_u8Z_free(ret_var);
38011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38012 LDKu8slice ser_ref;
38013 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38014 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38015 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
38016 *ret_conv = ChannelUpdate_read(ser_ref);
38017 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38018 return (int64_t)ret_conv;
38021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38022 LDKErrorMessage obj_conv;
38023 obj_conv.inner = (void*)(obj & (~1));
38024 obj_conv.is_owned = false;
38025 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38026 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
38027 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38028 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38029 CVec_u8Z_free(ret_var);
38033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38034 LDKu8slice ser_ref;
38035 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38036 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38037 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
38038 *ret_conv = ErrorMessage_read(ser_ref);
38039 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38040 return (int64_t)ret_conv;
38043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38044 LDKWarningMessage obj_conv;
38045 obj_conv.inner = (void*)(obj & (~1));
38046 obj_conv.is_owned = false;
38047 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38048 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
38049 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38050 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38051 CVec_u8Z_free(ret_var);
38055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38056 LDKu8slice ser_ref;
38057 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38058 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38059 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
38060 *ret_conv = WarningMessage_read(ser_ref);
38061 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38062 return (int64_t)ret_conv;
38065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38066 LDKUnsignedNodeAnnouncement obj_conv;
38067 obj_conv.inner = (void*)(obj & (~1));
38068 obj_conv.is_owned = false;
38069 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38070 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
38071 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38072 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38073 CVec_u8Z_free(ret_var);
38077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38078 LDKu8slice ser_ref;
38079 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38080 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38081 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
38082 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
38083 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38084 return (int64_t)ret_conv;
38087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38088 LDKNodeAnnouncement obj_conv;
38089 obj_conv.inner = (void*)(obj & (~1));
38090 obj_conv.is_owned = false;
38091 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38092 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
38093 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38094 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38095 CVec_u8Z_free(ret_var);
38099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38100 LDKu8slice ser_ref;
38101 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38102 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38103 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
38104 *ret_conv = NodeAnnouncement_read(ser_ref);
38105 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38106 return (int64_t)ret_conv;
38109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38110 LDKu8slice ser_ref;
38111 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38112 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38113 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
38114 *ret_conv = QueryShortChannelIds_read(ser_ref);
38115 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38116 return (int64_t)ret_conv;
38119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
38120 LDKQueryShortChannelIds obj_conv;
38121 obj_conv.inner = (void*)(obj & (~1));
38122 obj_conv.is_owned = false;
38123 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38124 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
38125 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38126 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38127 CVec_u8Z_free(ret_var);
38131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
38132 LDKReplyShortChannelIdsEnd obj_conv;
38133 obj_conv.inner = (void*)(obj & (~1));
38134 obj_conv.is_owned = false;
38135 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38136 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
38137 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38138 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38139 CVec_u8Z_free(ret_var);
38143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38144 LDKu8slice ser_ref;
38145 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38146 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38147 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
38148 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
38149 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38150 return (int64_t)ret_conv;
38153 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
38154 LDKQueryChannelRange this_arg_conv;
38155 this_arg_conv.inner = (void*)(this_arg & (~1));
38156 this_arg_conv.is_owned = false;
38157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38158 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
38162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
38163 LDKQueryChannelRange obj_conv;
38164 obj_conv.inner = (void*)(obj & (~1));
38165 obj_conv.is_owned = false;
38166 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38167 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
38168 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38169 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38170 CVec_u8Z_free(ret_var);
38174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38175 LDKu8slice ser_ref;
38176 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38177 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38178 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
38179 *ret_conv = QueryChannelRange_read(ser_ref);
38180 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38181 return (int64_t)ret_conv;
38184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38185 LDKu8slice ser_ref;
38186 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38187 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38188 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
38189 *ret_conv = ReplyChannelRange_read(ser_ref);
38190 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38191 return (int64_t)ret_conv;
38194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
38195 LDKReplyChannelRange obj_conv;
38196 obj_conv.inner = (void*)(obj & (~1));
38197 obj_conv.is_owned = false;
38198 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38199 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
38200 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38201 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38202 CVec_u8Z_free(ret_var);
38206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
38207 LDKGossipTimestampFilter obj_conv;
38208 obj_conv.inner = (void*)(obj & (~1));
38209 obj_conv.is_owned = false;
38210 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38211 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
38212 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38213 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38214 CVec_u8Z_free(ret_var);
38218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38219 LDKu8slice ser_ref;
38220 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38221 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38222 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
38223 *ret_conv = GossipTimestampFilter_read(ser_ref);
38224 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38225 return (int64_t)ret_conv;
38228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38229 if ((this_ptr & 1) != 0) return;
38230 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38231 CHECK_ACCESS(this_ptr_ptr);
38232 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
38233 FREE((void*)this_ptr);
38234 CustomMessageHandler_free(this_ptr_conv);
38237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38238 LDKIgnoringMessageHandler this_obj_conv;
38239 this_obj_conv.inner = (void*)(this_obj & (~1));
38240 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38242 IgnoringMessageHandler_free(this_obj_conv);
38245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
38246 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
38247 int64_t ret_ref = 0;
38248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38251 ret_ref = (uintptr_t)ret_var.inner;
38252 if (ret_var.is_owned) {
38258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38259 LDKIgnoringMessageHandler this_arg_conv;
38260 this_arg_conv.inner = (void*)(this_arg & (~1));
38261 this_arg_conv.is_owned = false;
38262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38263 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38264 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
38265 return (int64_t)ret_ret;
38268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38269 LDKIgnoringMessageHandler this_arg_conv;
38270 this_arg_conv.inner = (void*)(this_arg & (~1));
38271 this_arg_conv.is_owned = false;
38272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38273 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
38274 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
38275 return (int64_t)ret_ret;
38278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
38279 LDKIgnoringMessageHandler this_arg_conv;
38280 this_arg_conv.inner = (void*)(this_arg & (~1));
38281 this_arg_conv.is_owned = false;
38282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38283 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
38284 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
38285 return (int64_t)ret_ret;
38288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38289 LDKIgnoringMessageHandler this_arg_conv;
38290 this_arg_conv.inner = (void*)(this_arg & (~1));
38291 this_arg_conv.is_owned = false;
38292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38293 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
38294 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
38295 return (int64_t)ret_ret;
38298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38299 LDKErroringMessageHandler this_obj_conv;
38300 this_obj_conv.inner = (void*)(this_obj & (~1));
38301 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38303 ErroringMessageHandler_free(this_obj_conv);
38306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
38307 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
38308 int64_t ret_ref = 0;
38309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38312 ret_ref = (uintptr_t)ret_var.inner;
38313 if (ret_var.is_owned) {
38319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38320 LDKErroringMessageHandler this_arg_conv;
38321 this_arg_conv.inner = (void*)(this_arg & (~1));
38322 this_arg_conv.is_owned = false;
38323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38324 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38325 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
38326 return (int64_t)ret_ret;
38329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38330 LDKErroringMessageHandler this_arg_conv;
38331 this_arg_conv.inner = (void*)(this_arg & (~1));
38332 this_arg_conv.is_owned = false;
38333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38334 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
38335 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
38336 return (int64_t)ret_ret;
38339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38340 LDKMessageHandler this_obj_conv;
38341 this_obj_conv.inner = (void*)(this_obj & (~1));
38342 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38344 MessageHandler_free(this_obj_conv);
38347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
38348 LDKMessageHandler this_ptr_conv;
38349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38350 this_ptr_conv.is_owned = false;
38351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38352 // WARNING: This object doesn't live past this scope, needs clone!
38353 int64_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
38357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38358 LDKMessageHandler this_ptr_conv;
38359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38360 this_ptr_conv.is_owned = false;
38361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38362 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38363 CHECK_ACCESS(val_ptr);
38364 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
38365 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
38366 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38367 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
38369 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
38372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
38373 LDKMessageHandler this_ptr_conv;
38374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38375 this_ptr_conv.is_owned = false;
38376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38377 // WARNING: This object doesn't live past this scope, needs clone!
38378 int64_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
38382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38383 LDKMessageHandler this_ptr_conv;
38384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38385 this_ptr_conv.is_owned = false;
38386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38387 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38388 CHECK_ACCESS(val_ptr);
38389 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
38390 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
38391 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38392 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
38394 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
38397 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) {
38398 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
38399 CHECK_ACCESS(chan_handler_arg_ptr);
38400 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
38401 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
38402 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38403 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
38405 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
38406 CHECK_ACCESS(route_handler_arg_ptr);
38407 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
38408 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
38409 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38410 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
38412 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
38413 int64_t ret_ref = 0;
38414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38417 ret_ref = (uintptr_t)ret_var.inner;
38418 if (ret_var.is_owned) {
38424 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
38425 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
38426 *ret_ret = SocketDescriptor_clone(arg);
38427 return (int64_t)ret_ret;
38429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38430 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
38431 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
38432 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
38433 int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
38437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38438 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
38439 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
38440 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
38441 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
38442 *ret_ret = SocketDescriptor_clone(orig_conv);
38443 return (int64_t)ret_ret;
38446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38447 if ((this_ptr & 1) != 0) return;
38448 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38449 CHECK_ACCESS(this_ptr_ptr);
38450 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
38451 FREE((void*)this_ptr);
38452 SocketDescriptor_free(this_ptr_conv);
38455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38456 LDKPeerHandleError this_obj_conv;
38457 this_obj_conv.inner = (void*)(this_obj & (~1));
38458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38460 PeerHandleError_free(this_obj_conv);
38463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
38464 LDKPeerHandleError this_ptr_conv;
38465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38466 this_ptr_conv.is_owned = false;
38467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38468 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
38472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38473 LDKPeerHandleError this_ptr_conv;
38474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38475 this_ptr_conv.is_owned = false;
38476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38477 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
38480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
38481 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
38482 int64_t ret_ref = 0;
38483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38486 ret_ref = (uintptr_t)ret_var.inner;
38487 if (ret_var.is_owned) {
38493 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
38494 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
38495 int64_t ret_ref = 0;
38496 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38497 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38499 ret_ref = (uintptr_t)ret_var.inner;
38500 if (ret_var.is_owned) {
38505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38506 LDKPeerHandleError arg_conv;
38507 arg_conv.inner = (void*)(arg & (~1));
38508 arg_conv.is_owned = false;
38509 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38510 int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
38514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38515 LDKPeerHandleError orig_conv;
38516 orig_conv.inner = (void*)(orig & (~1));
38517 orig_conv.is_owned = false;
38518 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38519 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
38520 int64_t ret_ref = 0;
38521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38524 ret_ref = (uintptr_t)ret_var.inner;
38525 if (ret_var.is_owned) {
38531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38532 LDKPeerManager this_obj_conv;
38533 this_obj_conv.inner = (void*)(this_obj & (~1));
38534 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38536 PeerManager_free(this_obj_conv);
38539 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) {
38540 LDKMessageHandler message_handler_conv;
38541 message_handler_conv.inner = (void*)(message_handler & (~1));
38542 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
38543 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
38544 // WARNING: we need a move here but no clone is available for LDKMessageHandler
38545 LDKSecretKey our_node_secret_ref;
38546 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
38547 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
38548 unsigned char ephemeral_random_data_arr[32];
38549 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
38550 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
38551 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
38552 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
38553 CHECK_ACCESS(logger_ptr);
38554 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38555 if (logger_conv.free == LDKLogger_JCalls_free) {
38556 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38557 LDKLogger_JCalls_cloned(&logger_conv);
38559 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
38560 CHECK_ACCESS(custom_message_handler_ptr);
38561 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
38562 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
38563 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38564 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
38566 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
38567 int64_t ret_ref = 0;
38568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38571 ret_ref = (uintptr_t)ret_var.inner;
38572 if (ret_var.is_owned) {
38578 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
38579 LDKPeerManager this_arg_conv;
38580 this_arg_conv.inner = (void*)(this_arg & (~1));
38581 this_arg_conv.is_owned = false;
38582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38583 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
38584 jobjectArray ret_arr = NULL;
38585 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38587 for (size_t i = 0; i < ret_var.datalen; i++) {
38588 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
38589 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
38590 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38593 FREE(ret_var.data);
38597 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) {
38598 LDKPeerManager this_arg_conv;
38599 this_arg_conv.inner = (void*)(this_arg & (~1));
38600 this_arg_conv.is_owned = false;
38601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38602 LDKPublicKey their_node_id_ref;
38603 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
38604 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
38605 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38606 CHECK_ACCESS(descriptor_ptr);
38607 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
38608 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
38609 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38610 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
38612 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
38613 CHECK_ACCESS(remote_network_address_ptr);
38614 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
38615 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
38616 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
38617 return (int64_t)ret_conv;
38620 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) {
38621 LDKPeerManager this_arg_conv;
38622 this_arg_conv.inner = (void*)(this_arg & (~1));
38623 this_arg_conv.is_owned = false;
38624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38625 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38626 CHECK_ACCESS(descriptor_ptr);
38627 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
38628 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
38629 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38630 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
38632 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
38633 CHECK_ACCESS(remote_network_address_ptr);
38634 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
38635 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
38636 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
38637 return (int64_t)ret_conv;
38640 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) {
38641 LDKPeerManager this_arg_conv;
38642 this_arg_conv.inner = (void*)(this_arg & (~1));
38643 this_arg_conv.is_owned = false;
38644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38645 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38646 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
38647 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
38648 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
38649 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
38650 return (int64_t)ret_conv;
38653 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) {
38654 LDKPeerManager this_arg_conv;
38655 this_arg_conv.inner = (void*)(this_arg & (~1));
38656 this_arg_conv.is_owned = false;
38657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38658 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
38659 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
38660 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
38661 LDKu8slice data_ref;
38662 data_ref.datalen = (*env)->GetArrayLength(env, data);
38663 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
38664 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
38665 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
38666 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
38667 return (int64_t)ret_conv;
38670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
38671 LDKPeerManager this_arg_conv;
38672 this_arg_conv.inner = (void*)(this_arg & (~1));
38673 this_arg_conv.is_owned = false;
38674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38675 PeerManager_process_events(&this_arg_conv);
38678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
38679 LDKPeerManager this_arg_conv;
38680 this_arg_conv.inner = (void*)(this_arg & (~1));
38681 this_arg_conv.is_owned = false;
38682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38683 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
38684 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
38685 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
38686 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
38689 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) {
38690 LDKPeerManager this_arg_conv;
38691 this_arg_conv.inner = (void*)(this_arg & (~1));
38692 this_arg_conv.is_owned = false;
38693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38694 LDKPublicKey node_id_ref;
38695 CHECK((*env)->GetArrayLength(env, node_id) == 33);
38696 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
38697 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
38700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
38701 LDKPeerManager this_arg_conv;
38702 this_arg_conv.inner = (void*)(this_arg & (~1));
38703 this_arg_conv.is_owned = false;
38704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38705 PeerManager_disconnect_all_peers(&this_arg_conv);
38708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
38709 LDKPeerManager this_arg_conv;
38710 this_arg_conv.inner = (void*)(this_arg & (~1));
38711 this_arg_conv.is_owned = false;
38712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38713 PeerManager_timer_tick_occurred(&this_arg_conv);
38716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
38717 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
38721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
38722 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
38726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
38727 unsigned char commitment_seed_arr[32];
38728 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
38729 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
38730 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
38731 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38732 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
38736 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) {
38737 LDKCVec_u8Z to_holder_script_ref;
38738 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
38739 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
38740 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
38741 LDKCVec_u8Z to_counterparty_script_ref;
38742 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
38743 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
38744 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
38745 LDKOutPoint funding_outpoint_conv;
38746 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
38747 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
38748 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38749 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38750 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);
38751 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38752 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38753 Transaction_free(ret_var);
38757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38758 LDKCounterpartyCommitmentSecrets this_obj_conv;
38759 this_obj_conv.inner = (void*)(this_obj & (~1));
38760 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38762 CounterpartyCommitmentSecrets_free(this_obj_conv);
38765 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
38766 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
38767 int64_t ret_ref = 0;
38768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38771 ret_ref = (uintptr_t)ret_var.inner;
38772 if (ret_var.is_owned) {
38777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38778 LDKCounterpartyCommitmentSecrets arg_conv;
38779 arg_conv.inner = (void*)(arg & (~1));
38780 arg_conv.is_owned = false;
38781 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38782 int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
38786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38787 LDKCounterpartyCommitmentSecrets orig_conv;
38788 orig_conv.inner = (void*)(orig & (~1));
38789 orig_conv.is_owned = false;
38790 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38791 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
38792 int64_t ret_ref = 0;
38793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38796 ret_ref = (uintptr_t)ret_var.inner;
38797 if (ret_var.is_owned) {
38803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
38804 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
38805 int64_t ret_ref = 0;
38806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38809 ret_ref = (uintptr_t)ret_var.inner;
38810 if (ret_var.is_owned) {
38816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
38817 LDKCounterpartyCommitmentSecrets this_arg_conv;
38818 this_arg_conv.inner = (void*)(this_arg & (~1));
38819 this_arg_conv.is_owned = false;
38820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38821 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
38825 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) {
38826 LDKCounterpartyCommitmentSecrets this_arg_conv;
38827 this_arg_conv.inner = (void*)(this_arg & (~1));
38828 this_arg_conv.is_owned = false;
38829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38830 LDKThirtyTwoBytes secret_ref;
38831 CHECK((*env)->GetArrayLength(env, secret) == 32);
38832 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
38833 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
38834 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
38835 return (int64_t)ret_conv;
38838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
38839 LDKCounterpartyCommitmentSecrets this_arg_conv;
38840 this_arg_conv.inner = (void*)(this_arg & (~1));
38841 this_arg_conv.is_owned = false;
38842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38843 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38844 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
38848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
38849 LDKCounterpartyCommitmentSecrets obj_conv;
38850 obj_conv.inner = (void*)(obj & (~1));
38851 obj_conv.is_owned = false;
38852 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38853 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
38854 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38855 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38856 CVec_u8Z_free(ret_var);
38860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38861 LDKu8slice ser_ref;
38862 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38863 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38864 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
38865 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
38866 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38867 return (int64_t)ret_conv;
38870 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) {
38871 LDKPublicKey per_commitment_point_ref;
38872 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38873 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38874 unsigned char base_secret_arr[32];
38875 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
38876 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
38877 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
38878 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
38879 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
38880 return (int64_t)ret_conv;
38883 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) {
38884 LDKPublicKey per_commitment_point_ref;
38885 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38886 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38887 LDKPublicKey base_point_ref;
38888 CHECK((*env)->GetArrayLength(env, base_point) == 33);
38889 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
38890 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
38891 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
38892 return (int64_t)ret_conv;
38895 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) {
38896 unsigned char per_commitment_secret_arr[32];
38897 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
38898 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
38899 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
38900 unsigned char countersignatory_revocation_base_secret_arr[32];
38901 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
38902 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
38903 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
38904 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
38905 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
38906 return (int64_t)ret_conv;
38909 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) {
38910 LDKPublicKey per_commitment_point_ref;
38911 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
38912 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
38913 LDKPublicKey countersignatory_revocation_base_point_ref;
38914 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
38915 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
38916 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
38917 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
38918 return (int64_t)ret_conv;
38921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38922 LDKTxCreationKeys this_obj_conv;
38923 this_obj_conv.inner = (void*)(this_obj & (~1));
38924 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38926 TxCreationKeys_free(this_obj_conv);
38929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
38930 LDKTxCreationKeys this_ptr_conv;
38931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38932 this_ptr_conv.is_owned = false;
38933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38934 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
38939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38940 LDKTxCreationKeys this_ptr_conv;
38941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38942 this_ptr_conv.is_owned = false;
38943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38944 LDKPublicKey val_ref;
38945 CHECK((*env)->GetArrayLength(env, val) == 33);
38946 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38947 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
38950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38951 LDKTxCreationKeys this_ptr_conv;
38952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38953 this_ptr_conv.is_owned = false;
38954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38955 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38956 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
38960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38961 LDKTxCreationKeys this_ptr_conv;
38962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38963 this_ptr_conv.is_owned = false;
38964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38965 LDKPublicKey val_ref;
38966 CHECK((*env)->GetArrayLength(env, val) == 33);
38967 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38968 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
38971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38972 LDKTxCreationKeys this_ptr_conv;
38973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38974 this_ptr_conv.is_owned = false;
38975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38976 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38977 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
38981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38982 LDKTxCreationKeys this_ptr_conv;
38983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38984 this_ptr_conv.is_owned = false;
38985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38986 LDKPublicKey val_ref;
38987 CHECK((*env)->GetArrayLength(env, val) == 33);
38988 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38989 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
38992 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
38993 LDKTxCreationKeys this_ptr_conv;
38994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38995 this_ptr_conv.is_owned = false;
38996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38997 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38998 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
39002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39003 LDKTxCreationKeys this_ptr_conv;
39004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39005 this_ptr_conv.is_owned = false;
39006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39007 LDKPublicKey val_ref;
39008 CHECK((*env)->GetArrayLength(env, val) == 33);
39009 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39010 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
39013 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
39014 LDKTxCreationKeys this_ptr_conv;
39015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39016 this_ptr_conv.is_owned = false;
39017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39018 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39019 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
39023 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) {
39024 LDKTxCreationKeys this_ptr_conv;
39025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39026 this_ptr_conv.is_owned = false;
39027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39028 LDKPublicKey val_ref;
39029 CHECK((*env)->GetArrayLength(env, val) == 33);
39030 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39031 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
39034 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) {
39035 LDKPublicKey per_commitment_point_arg_ref;
39036 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
39037 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
39038 LDKPublicKey revocation_key_arg_ref;
39039 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
39040 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
39041 LDKPublicKey broadcaster_htlc_key_arg_ref;
39042 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
39043 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
39044 LDKPublicKey countersignatory_htlc_key_arg_ref;
39045 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
39046 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
39047 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
39048 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
39049 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
39050 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);
39051 int64_t ret_ref = 0;
39052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39055 ret_ref = (uintptr_t)ret_var.inner;
39056 if (ret_var.is_owned) {
39062 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
39063 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
39064 int64_t ret_ref = 0;
39065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39068 ret_ref = (uintptr_t)ret_var.inner;
39069 if (ret_var.is_owned) {
39074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39075 LDKTxCreationKeys arg_conv;
39076 arg_conv.inner = (void*)(arg & (~1));
39077 arg_conv.is_owned = false;
39078 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39079 int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
39083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39084 LDKTxCreationKeys orig_conv;
39085 orig_conv.inner = (void*)(orig & (~1));
39086 orig_conv.is_owned = false;
39087 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39088 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
39089 int64_t ret_ref = 0;
39090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39093 ret_ref = (uintptr_t)ret_var.inner;
39094 if (ret_var.is_owned) {
39100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
39101 LDKTxCreationKeys obj_conv;
39102 obj_conv.inner = (void*)(obj & (~1));
39103 obj_conv.is_owned = false;
39104 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39105 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
39106 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39107 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39108 CVec_u8Z_free(ret_var);
39112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39113 LDKu8slice ser_ref;
39114 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39115 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39116 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
39117 *ret_conv = TxCreationKeys_read(ser_ref);
39118 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39119 return (int64_t)ret_conv;
39122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39123 LDKChannelPublicKeys this_obj_conv;
39124 this_obj_conv.inner = (void*)(this_obj & (~1));
39125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39127 ChannelPublicKeys_free(this_obj_conv);
39130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39131 LDKChannelPublicKeys this_ptr_conv;
39132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39133 this_ptr_conv.is_owned = false;
39134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39135 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39136 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
39140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39141 LDKChannelPublicKeys this_ptr_conv;
39142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39143 this_ptr_conv.is_owned = false;
39144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39145 LDKPublicKey val_ref;
39146 CHECK((*env)->GetArrayLength(env, val) == 33);
39147 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39148 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
39151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39152 LDKChannelPublicKeys this_ptr_conv;
39153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39154 this_ptr_conv.is_owned = false;
39155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39156 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39157 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
39161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39162 LDKChannelPublicKeys this_ptr_conv;
39163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39164 this_ptr_conv.is_owned = false;
39165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39166 LDKPublicKey val_ref;
39167 CHECK((*env)->GetArrayLength(env, val) == 33);
39168 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39169 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
39172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
39173 LDKChannelPublicKeys this_ptr_conv;
39174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39175 this_ptr_conv.is_owned = false;
39176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39177 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
39182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39183 LDKChannelPublicKeys this_ptr_conv;
39184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39185 this_ptr_conv.is_owned = false;
39186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39187 LDKPublicKey val_ref;
39188 CHECK((*env)->GetArrayLength(env, val) == 33);
39189 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39190 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
39193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39194 LDKChannelPublicKeys this_ptr_conv;
39195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39196 this_ptr_conv.is_owned = false;
39197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39198 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
39203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39204 LDKChannelPublicKeys this_ptr_conv;
39205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39206 this_ptr_conv.is_owned = false;
39207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39208 LDKPublicKey val_ref;
39209 CHECK((*env)->GetArrayLength(env, val) == 33);
39210 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39211 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
39214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39215 LDKChannelPublicKeys this_ptr_conv;
39216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39217 this_ptr_conv.is_owned = false;
39218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39219 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39220 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
39224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39225 LDKChannelPublicKeys this_ptr_conv;
39226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39227 this_ptr_conv.is_owned = false;
39228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39229 LDKPublicKey val_ref;
39230 CHECK((*env)->GetArrayLength(env, val) == 33);
39231 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39232 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
39235 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) {
39236 LDKPublicKey funding_pubkey_arg_ref;
39237 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
39238 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
39239 LDKPublicKey revocation_basepoint_arg_ref;
39240 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
39241 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
39242 LDKPublicKey payment_point_arg_ref;
39243 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
39244 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
39245 LDKPublicKey delayed_payment_basepoint_arg_ref;
39246 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
39247 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
39248 LDKPublicKey htlc_basepoint_arg_ref;
39249 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
39250 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
39251 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);
39252 int64_t ret_ref = 0;
39253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39256 ret_ref = (uintptr_t)ret_var.inner;
39257 if (ret_var.is_owned) {
39263 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
39264 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
39265 int64_t ret_ref = 0;
39266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39269 ret_ref = (uintptr_t)ret_var.inner;
39270 if (ret_var.is_owned) {
39275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39276 LDKChannelPublicKeys arg_conv;
39277 arg_conv.inner = (void*)(arg & (~1));
39278 arg_conv.is_owned = false;
39279 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39280 int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
39284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39285 LDKChannelPublicKeys orig_conv;
39286 orig_conv.inner = (void*)(orig & (~1));
39287 orig_conv.is_owned = false;
39288 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39289 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
39290 int64_t ret_ref = 0;
39291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39294 ret_ref = (uintptr_t)ret_var.inner;
39295 if (ret_var.is_owned) {
39301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
39302 LDKChannelPublicKeys obj_conv;
39303 obj_conv.inner = (void*)(obj & (~1));
39304 obj_conv.is_owned = false;
39305 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39306 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
39307 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39308 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39309 CVec_u8Z_free(ret_var);
39313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39314 LDKu8slice ser_ref;
39315 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39316 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39317 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
39318 *ret_conv = ChannelPublicKeys_read(ser_ref);
39319 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39320 return (int64_t)ret_conv;
39323 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) {
39324 LDKPublicKey per_commitment_point_ref;
39325 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39326 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39327 LDKPublicKey broadcaster_delayed_payment_base_ref;
39328 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
39329 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
39330 LDKPublicKey broadcaster_htlc_base_ref;
39331 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
39332 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
39333 LDKPublicKey countersignatory_revocation_base_ref;
39334 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
39335 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
39336 LDKPublicKey countersignatory_htlc_base_ref;
39337 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
39338 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
39339 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
39340 *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);
39341 return (int64_t)ret_conv;
39344 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) {
39345 LDKPublicKey per_commitment_point_ref;
39346 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39347 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39348 LDKChannelPublicKeys broadcaster_keys_conv;
39349 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
39350 broadcaster_keys_conv.is_owned = false;
39351 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39352 LDKChannelPublicKeys countersignatory_keys_conv;
39353 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
39354 countersignatory_keys_conv.is_owned = false;
39355 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39356 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
39357 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
39358 return (int64_t)ret_conv;
39361 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) {
39362 LDKPublicKey revocation_key_ref;
39363 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
39364 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
39365 LDKPublicKey broadcaster_delayed_payment_key_ref;
39366 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
39367 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
39368 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
39369 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39370 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39371 CVec_u8Z_free(ret_var);
39375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39376 LDKHTLCOutputInCommitment this_obj_conv;
39377 this_obj_conv.inner = (void*)(this_obj & (~1));
39378 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39380 HTLCOutputInCommitment_free(this_obj_conv);
39383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
39384 LDKHTLCOutputInCommitment this_ptr_conv;
39385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39386 this_ptr_conv.is_owned = false;
39387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39388 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
39392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39393 LDKHTLCOutputInCommitment this_ptr_conv;
39394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39395 this_ptr_conv.is_owned = false;
39396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39397 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
39400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39401 LDKHTLCOutputInCommitment this_ptr_conv;
39402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39403 this_ptr_conv.is_owned = false;
39404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39405 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
39409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39410 LDKHTLCOutputInCommitment this_ptr_conv;
39411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39412 this_ptr_conv.is_owned = false;
39413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39414 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
39417 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
39418 LDKHTLCOutputInCommitment this_ptr_conv;
39419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39420 this_ptr_conv.is_owned = false;
39421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39422 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
39426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39427 LDKHTLCOutputInCommitment this_ptr_conv;
39428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39429 this_ptr_conv.is_owned = false;
39430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39431 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
39434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39435 LDKHTLCOutputInCommitment this_ptr_conv;
39436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39437 this_ptr_conv.is_owned = false;
39438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39439 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39440 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
39444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39445 LDKHTLCOutputInCommitment this_ptr_conv;
39446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39447 this_ptr_conv.is_owned = false;
39448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39449 LDKThirtyTwoBytes val_ref;
39450 CHECK((*env)->GetArrayLength(env, val) == 32);
39451 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39452 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
39455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
39456 LDKHTLCOutputInCommitment this_ptr_conv;
39457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39458 this_ptr_conv.is_owned = false;
39459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39460 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39461 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
39462 int64_t ret_ref = (uintptr_t)ret_copy;
39466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39467 LDKHTLCOutputInCommitment this_ptr_conv;
39468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39469 this_ptr_conv.is_owned = false;
39470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39471 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39472 CHECK_ACCESS(val_ptr);
39473 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39474 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
39475 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
39478 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) {
39479 LDKThirtyTwoBytes payment_hash_arg_ref;
39480 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
39481 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
39482 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
39483 CHECK_ACCESS(transaction_output_index_arg_ptr);
39484 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
39485 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
39486 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
39487 int64_t ret_ref = 0;
39488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39491 ret_ref = (uintptr_t)ret_var.inner;
39492 if (ret_var.is_owned) {
39498 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
39499 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
39500 int64_t ret_ref = 0;
39501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39504 ret_ref = (uintptr_t)ret_var.inner;
39505 if (ret_var.is_owned) {
39510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39511 LDKHTLCOutputInCommitment arg_conv;
39512 arg_conv.inner = (void*)(arg & (~1));
39513 arg_conv.is_owned = false;
39514 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39515 int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
39519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39520 LDKHTLCOutputInCommitment orig_conv;
39521 orig_conv.inner = (void*)(orig & (~1));
39522 orig_conv.is_owned = false;
39523 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39524 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
39525 int64_t ret_ref = 0;
39526 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39527 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39529 ret_ref = (uintptr_t)ret_var.inner;
39530 if (ret_var.is_owned) {
39536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
39537 LDKHTLCOutputInCommitment obj_conv;
39538 obj_conv.inner = (void*)(obj & (~1));
39539 obj_conv.is_owned = false;
39540 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39541 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
39542 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39543 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39544 CVec_u8Z_free(ret_var);
39548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39549 LDKu8slice ser_ref;
39550 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39551 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39552 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
39553 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
39554 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39555 return (int64_t)ret_conv;
39558 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) {
39559 LDKHTLCOutputInCommitment htlc_conv;
39560 htlc_conv.inner = (void*)(htlc & (~1));
39561 htlc_conv.is_owned = false;
39562 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
39563 LDKTxCreationKeys keys_conv;
39564 keys_conv.inner = (void*)(keys & (~1));
39565 keys_conv.is_owned = false;
39566 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
39567 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
39568 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39569 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39570 CVec_u8Z_free(ret_var);
39574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
39575 LDKPublicKey broadcaster_ref;
39576 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
39577 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
39578 LDKPublicKey countersignatory_ref;
39579 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
39580 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
39581 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
39582 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39583 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39584 CVec_u8Z_free(ret_var);
39588 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) {
39589 unsigned char commitment_txid_arr[32];
39590 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
39591 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
39592 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
39593 LDKHTLCOutputInCommitment htlc_conv;
39594 htlc_conv.inner = (void*)(htlc & (~1));
39595 htlc_conv.is_owned = false;
39596 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
39597 LDKPublicKey broadcaster_delayed_payment_key_ref;
39598 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
39599 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
39600 LDKPublicKey revocation_key_ref;
39601 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
39602 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
39603 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);
39604 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39605 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39606 Transaction_free(ret_var);
39610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
39611 LDKPublicKey funding_pubkey_ref;
39612 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
39613 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
39614 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
39615 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39616 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39617 CVec_u8Z_free(ret_var);
39621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39622 LDKChannelTransactionParameters this_obj_conv;
39623 this_obj_conv.inner = (void*)(this_obj & (~1));
39624 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39626 ChannelTransactionParameters_free(this_obj_conv);
39629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
39630 LDKChannelTransactionParameters this_ptr_conv;
39631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39632 this_ptr_conv.is_owned = false;
39633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39634 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
39635 int64_t ret_ref = 0;
39636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39639 ret_ref = (uintptr_t)ret_var.inner;
39640 if (ret_var.is_owned) {
39646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39647 LDKChannelTransactionParameters this_ptr_conv;
39648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39649 this_ptr_conv.is_owned = false;
39650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39651 LDKChannelPublicKeys val_conv;
39652 val_conv.inner = (void*)(val & (~1));
39653 val_conv.is_owned = (val & 1) || (val == 0);
39654 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39655 val_conv = ChannelPublicKeys_clone(&val_conv);
39656 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
39659 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39660 LDKChannelTransactionParameters this_ptr_conv;
39661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39662 this_ptr_conv.is_owned = false;
39663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39664 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
39668 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) {
39669 LDKChannelTransactionParameters this_ptr_conv;
39670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39671 this_ptr_conv.is_owned = false;
39672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39673 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
39676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
39677 LDKChannelTransactionParameters this_ptr_conv;
39678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39679 this_ptr_conv.is_owned = false;
39680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39681 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
39685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39686 LDKChannelTransactionParameters this_ptr_conv;
39687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39688 this_ptr_conv.is_owned = false;
39689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39690 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
39693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
39694 LDKChannelTransactionParameters this_ptr_conv;
39695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39696 this_ptr_conv.is_owned = false;
39697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39698 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
39699 int64_t ret_ref = 0;
39700 if ((uintptr_t)ret_var.inner > 4096) {
39701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39704 ret_ref = (uintptr_t)ret_var.inner;
39705 if (ret_var.is_owned) {
39712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39713 LDKChannelTransactionParameters this_ptr_conv;
39714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39715 this_ptr_conv.is_owned = false;
39716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39717 LDKCounterpartyChannelTransactionParameters val_conv;
39718 val_conv.inner = (void*)(val & (~1));
39719 val_conv.is_owned = (val & 1) || (val == 0);
39720 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39721 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
39722 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
39725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39726 LDKChannelTransactionParameters this_ptr_conv;
39727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39728 this_ptr_conv.is_owned = false;
39729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39730 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
39731 int64_t ret_ref = 0;
39732 if ((uintptr_t)ret_var.inner > 4096) {
39733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39736 ret_ref = (uintptr_t)ret_var.inner;
39737 if (ret_var.is_owned) {
39744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39745 LDKChannelTransactionParameters this_ptr_conv;
39746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39747 this_ptr_conv.is_owned = false;
39748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39749 LDKOutPoint val_conv;
39750 val_conv.inner = (void*)(val & (~1));
39751 val_conv.is_owned = (val & 1) || (val == 0);
39752 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39753 val_conv = OutPoint_clone(&val_conv);
39754 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
39757 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
39758 LDKChannelTransactionParameters this_ptr_conv;
39759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39760 this_ptr_conv.is_owned = false;
39761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39762 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
39766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
39767 LDKChannelTransactionParameters this_ptr_conv;
39768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39769 this_ptr_conv.is_owned = false;
39770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39771 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
39772 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
39775 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) {
39776 LDKChannelPublicKeys holder_pubkeys_arg_conv;
39777 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
39778 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
39779 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
39780 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
39781 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
39782 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
39783 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
39784 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
39785 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
39786 LDKOutPoint funding_outpoint_arg_conv;
39787 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
39788 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
39789 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
39790 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
39791 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
39792 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);
39793 int64_t ret_ref = 0;
39794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39795 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39797 ret_ref = (uintptr_t)ret_var.inner;
39798 if (ret_var.is_owned) {
39804 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
39805 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
39806 int64_t ret_ref = 0;
39807 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39808 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39810 ret_ref = (uintptr_t)ret_var.inner;
39811 if (ret_var.is_owned) {
39816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39817 LDKChannelTransactionParameters arg_conv;
39818 arg_conv.inner = (void*)(arg & (~1));
39819 arg_conv.is_owned = false;
39820 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39821 int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
39825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39826 LDKChannelTransactionParameters orig_conv;
39827 orig_conv.inner = (void*)(orig & (~1));
39828 orig_conv.is_owned = false;
39829 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39830 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
39831 int64_t ret_ref = 0;
39832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39835 ret_ref = (uintptr_t)ret_var.inner;
39836 if (ret_var.is_owned) {
39842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39843 LDKCounterpartyChannelTransactionParameters this_obj_conv;
39844 this_obj_conv.inner = (void*)(this_obj & (~1));
39845 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39847 CounterpartyChannelTransactionParameters_free(this_obj_conv);
39850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
39851 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39853 this_ptr_conv.is_owned = false;
39854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39855 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
39856 int64_t ret_ref = 0;
39857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39860 ret_ref = (uintptr_t)ret_var.inner;
39861 if (ret_var.is_owned) {
39867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39868 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39870 this_ptr_conv.is_owned = false;
39871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39872 LDKChannelPublicKeys val_conv;
39873 val_conv.inner = (void*)(val & (~1));
39874 val_conv.is_owned = (val & 1) || (val == 0);
39875 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39876 val_conv = ChannelPublicKeys_clone(&val_conv);
39877 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
39880 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39881 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39883 this_ptr_conv.is_owned = false;
39884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39885 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
39889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39890 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
39891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39892 this_ptr_conv.is_owned = false;
39893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39894 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
39897 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) {
39898 LDKChannelPublicKeys pubkeys_arg_conv;
39899 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
39900 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
39901 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
39902 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
39903 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
39904 int64_t ret_ref = 0;
39905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39908 ret_ref = (uintptr_t)ret_var.inner;
39909 if (ret_var.is_owned) {
39915 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
39916 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
39917 int64_t ret_ref = 0;
39918 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39919 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39921 ret_ref = (uintptr_t)ret_var.inner;
39922 if (ret_var.is_owned) {
39927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39928 LDKCounterpartyChannelTransactionParameters arg_conv;
39929 arg_conv.inner = (void*)(arg & (~1));
39930 arg_conv.is_owned = false;
39931 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39932 int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
39936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39937 LDKCounterpartyChannelTransactionParameters orig_conv;
39938 orig_conv.inner = (void*)(orig & (~1));
39939 orig_conv.is_owned = false;
39940 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39941 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
39942 int64_t ret_ref = 0;
39943 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39944 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39946 ret_ref = (uintptr_t)ret_var.inner;
39947 if (ret_var.is_owned) {
39953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
39954 LDKChannelTransactionParameters this_arg_conv;
39955 this_arg_conv.inner = (void*)(this_arg & (~1));
39956 this_arg_conv.is_owned = false;
39957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39958 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
39962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
39963 LDKChannelTransactionParameters this_arg_conv;
39964 this_arg_conv.inner = (void*)(this_arg & (~1));
39965 this_arg_conv.is_owned = false;
39966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39967 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
39968 int64_t ret_ref = 0;
39969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39972 ret_ref = (uintptr_t)ret_var.inner;
39973 if (ret_var.is_owned) {
39979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
39980 LDKChannelTransactionParameters this_arg_conv;
39981 this_arg_conv.inner = (void*)(this_arg & (~1));
39982 this_arg_conv.is_owned = false;
39983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39984 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
39985 int64_t ret_ref = 0;
39986 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39987 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39989 ret_ref = (uintptr_t)ret_var.inner;
39990 if (ret_var.is_owned) {
39996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
39997 LDKCounterpartyChannelTransactionParameters obj_conv;
39998 obj_conv.inner = (void*)(obj & (~1));
39999 obj_conv.is_owned = false;
40000 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40001 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
40002 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40003 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40004 CVec_u8Z_free(ret_var);
40008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40009 LDKu8slice ser_ref;
40010 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40011 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40012 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
40013 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
40014 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40015 return (int64_t)ret_conv;
40018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
40019 LDKChannelTransactionParameters obj_conv;
40020 obj_conv.inner = (void*)(obj & (~1));
40021 obj_conv.is_owned = false;
40022 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40023 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
40024 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40025 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40026 CVec_u8Z_free(ret_var);
40030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40031 LDKu8slice ser_ref;
40032 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40033 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40034 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
40035 *ret_conv = ChannelTransactionParameters_read(ser_ref);
40036 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40037 return (int64_t)ret_conv;
40040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40041 LDKDirectedChannelTransactionParameters this_obj_conv;
40042 this_obj_conv.inner = (void*)(this_obj & (~1));
40043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40045 DirectedChannelTransactionParameters_free(this_obj_conv);
40048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
40049 LDKDirectedChannelTransactionParameters this_arg_conv;
40050 this_arg_conv.inner = (void*)(this_arg & (~1));
40051 this_arg_conv.is_owned = false;
40052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40053 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
40054 int64_t ret_ref = 0;
40055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40058 ret_ref = (uintptr_t)ret_var.inner;
40059 if (ret_var.is_owned) {
40065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
40066 LDKDirectedChannelTransactionParameters this_arg_conv;
40067 this_arg_conv.inner = (void*)(this_arg & (~1));
40068 this_arg_conv.is_owned = false;
40069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40070 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
40071 int64_t ret_ref = 0;
40072 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40073 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40074 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40075 ret_ref = (uintptr_t)ret_var.inner;
40076 if (ret_var.is_owned) {
40082 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
40083 LDKDirectedChannelTransactionParameters this_arg_conv;
40084 this_arg_conv.inner = (void*)(this_arg & (~1));
40085 this_arg_conv.is_owned = false;
40086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40087 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
40091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
40092 LDKDirectedChannelTransactionParameters this_arg_conv;
40093 this_arg_conv.inner = (void*)(this_arg & (~1));
40094 this_arg_conv.is_owned = false;
40095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40096 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
40100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
40101 LDKDirectedChannelTransactionParameters this_arg_conv;
40102 this_arg_conv.inner = (void*)(this_arg & (~1));
40103 this_arg_conv.is_owned = false;
40104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40105 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
40106 int64_t ret_ref = 0;
40107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40110 ret_ref = (uintptr_t)ret_var.inner;
40111 if (ret_var.is_owned) {
40117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
40118 LDKDirectedChannelTransactionParameters this_arg_conv;
40119 this_arg_conv.inner = (void*)(this_arg & (~1));
40120 this_arg_conv.is_owned = false;
40121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40122 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
40126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40127 LDKHolderCommitmentTransaction this_obj_conv;
40128 this_obj_conv.inner = (void*)(this_obj & (~1));
40129 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40131 HolderCommitmentTransaction_free(this_obj_conv);
40134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
40135 LDKHolderCommitmentTransaction this_ptr_conv;
40136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40137 this_ptr_conv.is_owned = false;
40138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40139 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40140 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
40144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40145 LDKHolderCommitmentTransaction this_ptr_conv;
40146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40147 this_ptr_conv.is_owned = false;
40148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40149 LDKSignature val_ref;
40150 CHECK((*env)->GetArrayLength(env, val) == 64);
40151 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
40152 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
40155 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40156 LDKHolderCommitmentTransaction this_ptr_conv;
40157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40158 this_ptr_conv.is_owned = false;
40159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40160 LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
40161 jobjectArray ret_arr = NULL;
40162 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
40164 for (size_t i = 0; i < ret_var.datalen; i++) {
40165 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
40166 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
40167 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
40170 FREE(ret_var.data);
40174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
40175 LDKHolderCommitmentTransaction this_ptr_conv;
40176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40177 this_ptr_conv.is_owned = false;
40178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40179 LDKCVec_SignatureZ val_constr;
40180 val_constr.datalen = (*env)->GetArrayLength(env, val);
40181 if (val_constr.datalen > 0)
40182 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
40184 val_constr.data = NULL;
40185 for (size_t i = 0; i < val_constr.datalen; i++) {
40186 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
40187 LDKSignature val_conv_8_ref;
40188 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
40189 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
40190 val_constr.data[i] = val_conv_8_ref;
40192 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
40195 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
40196 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
40197 int64_t ret_ref = 0;
40198 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40199 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40201 ret_ref = (uintptr_t)ret_var.inner;
40202 if (ret_var.is_owned) {
40207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40208 LDKHolderCommitmentTransaction arg_conv;
40209 arg_conv.inner = (void*)(arg & (~1));
40210 arg_conv.is_owned = false;
40211 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40212 int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
40216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40217 LDKHolderCommitmentTransaction orig_conv;
40218 orig_conv.inner = (void*)(orig & (~1));
40219 orig_conv.is_owned = false;
40220 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40221 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
40222 int64_t ret_ref = 0;
40223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40226 ret_ref = (uintptr_t)ret_var.inner;
40227 if (ret_var.is_owned) {
40233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40234 LDKHolderCommitmentTransaction obj_conv;
40235 obj_conv.inner = (void*)(obj & (~1));
40236 obj_conv.is_owned = false;
40237 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40238 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
40239 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40240 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40241 CVec_u8Z_free(ret_var);
40245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40246 LDKu8slice ser_ref;
40247 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40248 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40249 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
40250 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
40251 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40252 return (int64_t)ret_conv;
40255 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) {
40256 LDKCommitmentTransaction commitment_tx_conv;
40257 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
40258 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
40259 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
40260 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
40261 LDKSignature counterparty_sig_ref;
40262 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
40263 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
40264 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
40265 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
40266 if (counterparty_htlc_sigs_constr.datalen > 0)
40267 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
40269 counterparty_htlc_sigs_constr.data = NULL;
40270 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
40271 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
40272 LDKSignature counterparty_htlc_sigs_conv_8_ref;
40273 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
40274 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
40275 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
40277 LDKPublicKey holder_funding_key_ref;
40278 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
40279 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
40280 LDKPublicKey counterparty_funding_key_ref;
40281 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
40282 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
40283 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
40284 int64_t ret_ref = 0;
40285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40288 ret_ref = (uintptr_t)ret_var.inner;
40289 if (ret_var.is_owned) {
40295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40296 LDKBuiltCommitmentTransaction this_obj_conv;
40297 this_obj_conv.inner = (void*)(this_obj & (~1));
40298 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40300 BuiltCommitmentTransaction_free(this_obj_conv);
40303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
40304 LDKBuiltCommitmentTransaction this_ptr_conv;
40305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40306 this_ptr_conv.is_owned = false;
40307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40308 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
40309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40311 Transaction_free(ret_var);
40315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40316 LDKBuiltCommitmentTransaction this_ptr_conv;
40317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40318 this_ptr_conv.is_owned = false;
40319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40320 LDKTransaction val_ref;
40321 val_ref.datalen = (*env)->GetArrayLength(env, val);
40322 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
40323 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
40324 val_ref.data_is_owned = true;
40325 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
40328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
40329 LDKBuiltCommitmentTransaction this_ptr_conv;
40330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40331 this_ptr_conv.is_owned = false;
40332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40333 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40334 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
40338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40339 LDKBuiltCommitmentTransaction this_ptr_conv;
40340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40341 this_ptr_conv.is_owned = false;
40342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40343 LDKThirtyTwoBytes val_ref;
40344 CHECK((*env)->GetArrayLength(env, val) == 32);
40345 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40346 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
40349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
40350 LDKTransaction transaction_arg_ref;
40351 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
40352 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
40353 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
40354 transaction_arg_ref.data_is_owned = true;
40355 LDKThirtyTwoBytes txid_arg_ref;
40356 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
40357 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
40358 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
40359 int64_t ret_ref = 0;
40360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40363 ret_ref = (uintptr_t)ret_var.inner;
40364 if (ret_var.is_owned) {
40370 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
40371 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
40372 int64_t ret_ref = 0;
40373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40376 ret_ref = (uintptr_t)ret_var.inner;
40377 if (ret_var.is_owned) {
40382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40383 LDKBuiltCommitmentTransaction arg_conv;
40384 arg_conv.inner = (void*)(arg & (~1));
40385 arg_conv.is_owned = false;
40386 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40387 int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
40391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40392 LDKBuiltCommitmentTransaction orig_conv;
40393 orig_conv.inner = (void*)(orig & (~1));
40394 orig_conv.is_owned = false;
40395 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40396 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
40397 int64_t ret_ref = 0;
40398 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40399 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40401 ret_ref = (uintptr_t)ret_var.inner;
40402 if (ret_var.is_owned) {
40408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40409 LDKBuiltCommitmentTransaction obj_conv;
40410 obj_conv.inner = (void*)(obj & (~1));
40411 obj_conv.is_owned = false;
40412 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40413 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
40414 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40415 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40416 CVec_u8Z_free(ret_var);
40420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40421 LDKu8slice ser_ref;
40422 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40423 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40424 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
40425 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
40426 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40427 return (int64_t)ret_conv;
40430 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) {
40431 LDKBuiltCommitmentTransaction this_arg_conv;
40432 this_arg_conv.inner = (void*)(this_arg & (~1));
40433 this_arg_conv.is_owned = false;
40434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40435 LDKu8slice funding_redeemscript_ref;
40436 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40437 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40438 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40439 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
40440 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40444 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) {
40445 LDKBuiltCommitmentTransaction this_arg_conv;
40446 this_arg_conv.inner = (void*)(this_arg & (~1));
40447 this_arg_conv.is_owned = false;
40448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40449 unsigned char funding_key_arr[32];
40450 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
40451 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
40452 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
40453 LDKu8slice funding_redeemscript_ref;
40454 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40455 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40456 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40457 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
40458 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40463 LDKClosingTransaction this_obj_conv;
40464 this_obj_conv.inner = (void*)(this_obj & (~1));
40465 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40467 ClosingTransaction_free(this_obj_conv);
40470 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
40471 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
40472 int64_t ret_ref = 0;
40473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40476 ret_ref = (uintptr_t)ret_var.inner;
40477 if (ret_var.is_owned) {
40482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40483 LDKClosingTransaction arg_conv;
40484 arg_conv.inner = (void*)(arg & (~1));
40485 arg_conv.is_owned = false;
40486 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40487 int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
40491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40492 LDKClosingTransaction orig_conv;
40493 orig_conv.inner = (void*)(orig & (~1));
40494 orig_conv.is_owned = false;
40495 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40496 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
40497 int64_t ret_ref = 0;
40498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40501 ret_ref = (uintptr_t)ret_var.inner;
40502 if (ret_var.is_owned) {
40508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
40509 LDKClosingTransaction o_conv;
40510 o_conv.inner = (void*)(o & (~1));
40511 o_conv.is_owned = false;
40512 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40513 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
40517 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) {
40518 LDKCVec_u8Z to_holder_script_ref;
40519 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
40520 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
40521 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
40522 LDKCVec_u8Z to_counterparty_script_ref;
40523 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
40524 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
40525 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
40526 LDKOutPoint funding_outpoint_conv;
40527 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
40528 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
40529 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
40530 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
40531 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
40532 int64_t ret_ref = 0;
40533 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40534 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40536 ret_ref = (uintptr_t)ret_var.inner;
40537 if (ret_var.is_owned) {
40543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
40544 LDKClosingTransaction this_arg_conv;
40545 this_arg_conv.inner = (void*)(this_arg & (~1));
40546 this_arg_conv.is_owned = false;
40547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40548 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
40549 int64_t ret_ref = 0;
40550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40553 ret_ref = (uintptr_t)ret_var.inner;
40554 if (ret_var.is_owned) {
40560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
40561 LDKClosingTransaction this_arg_conv;
40562 this_arg_conv.inner = (void*)(this_arg & (~1));
40563 this_arg_conv.is_owned = false;
40564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40565 LDKOutPoint funding_outpoint_conv;
40566 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
40567 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
40568 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
40569 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
40570 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
40571 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
40572 return (int64_t)ret_conv;
40575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40576 LDKClosingTransaction this_arg_conv;
40577 this_arg_conv.inner = (void*)(this_arg & (~1));
40578 this_arg_conv.is_owned = false;
40579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40580 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
40584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40585 LDKClosingTransaction this_arg_conv;
40586 this_arg_conv.inner = (void*)(this_arg & (~1));
40587 this_arg_conv.is_owned = false;
40588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40589 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
40593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40594 LDKClosingTransaction this_arg_conv;
40595 this_arg_conv.inner = (void*)(this_arg & (~1));
40596 this_arg_conv.is_owned = false;
40597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40598 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
40599 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40600 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40605 LDKClosingTransaction this_arg_conv;
40606 this_arg_conv.inner = (void*)(this_arg & (~1));
40607 this_arg_conv.is_owned = false;
40608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40609 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
40610 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40611 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40616 LDKTrustedClosingTransaction this_obj_conv;
40617 this_obj_conv.inner = (void*)(this_obj & (~1));
40618 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40620 TrustedClosingTransaction_free(this_obj_conv);
40623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
40624 LDKTrustedClosingTransaction this_arg_conv;
40625 this_arg_conv.inner = (void*)(this_arg & (~1));
40626 this_arg_conv.is_owned = false;
40627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40628 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
40629 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40630 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40631 Transaction_free(ret_var);
40635 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) {
40636 LDKTrustedClosingTransaction this_arg_conv;
40637 this_arg_conv.inner = (void*)(this_arg & (~1));
40638 this_arg_conv.is_owned = false;
40639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40640 LDKu8slice funding_redeemscript_ref;
40641 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40642 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40643 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40644 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
40645 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40649 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) {
40650 LDKTrustedClosingTransaction this_arg_conv;
40651 this_arg_conv.inner = (void*)(this_arg & (~1));
40652 this_arg_conv.is_owned = false;
40653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40654 unsigned char funding_key_arr[32];
40655 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
40656 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
40657 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
40658 LDKu8slice funding_redeemscript_ref;
40659 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40660 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40661 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40662 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
40663 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40668 LDKCommitmentTransaction this_obj_conv;
40669 this_obj_conv.inner = (void*)(this_obj & (~1));
40670 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40672 CommitmentTransaction_free(this_obj_conv);
40675 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
40676 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
40677 int64_t ret_ref = 0;
40678 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40679 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40681 ret_ref = (uintptr_t)ret_var.inner;
40682 if (ret_var.is_owned) {
40687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40688 LDKCommitmentTransaction arg_conv;
40689 arg_conv.inner = (void*)(arg & (~1));
40690 arg_conv.is_owned = false;
40691 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40692 int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
40696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40697 LDKCommitmentTransaction orig_conv;
40698 orig_conv.inner = (void*)(orig & (~1));
40699 orig_conv.is_owned = false;
40700 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40701 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
40702 int64_t ret_ref = 0;
40703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40706 ret_ref = (uintptr_t)ret_var.inner;
40707 if (ret_var.is_owned) {
40713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40714 LDKCommitmentTransaction obj_conv;
40715 obj_conv.inner = (void*)(obj & (~1));
40716 obj_conv.is_owned = false;
40717 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40718 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
40719 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40720 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40721 CVec_u8Z_free(ret_var);
40725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40726 LDKu8slice ser_ref;
40727 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40728 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40729 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
40730 *ret_conv = CommitmentTransaction_read(ser_ref);
40731 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40732 return (int64_t)ret_conv;
40735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
40736 LDKCommitmentTransaction this_arg_conv;
40737 this_arg_conv.inner = (void*)(this_arg & (~1));
40738 this_arg_conv.is_owned = false;
40739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40740 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
40744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40745 LDKCommitmentTransaction this_arg_conv;
40746 this_arg_conv.inner = (void*)(this_arg & (~1));
40747 this_arg_conv.is_owned = false;
40748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40749 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
40753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40754 LDKCommitmentTransaction this_arg_conv;
40755 this_arg_conv.inner = (void*)(this_arg & (~1));
40756 this_arg_conv.is_owned = false;
40757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40758 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
40762 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
40763 LDKCommitmentTransaction this_arg_conv;
40764 this_arg_conv.inner = (void*)(this_arg & (~1));
40765 this_arg_conv.is_owned = false;
40766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40767 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
40771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
40772 LDKCommitmentTransaction this_arg_conv;
40773 this_arg_conv.inner = (void*)(this_arg & (~1));
40774 this_arg_conv.is_owned = false;
40775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40776 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
40777 int64_t ret_ref = 0;
40778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40781 ret_ref = (uintptr_t)ret_var.inner;
40782 if (ret_var.is_owned) {
40788 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) {
40789 LDKCommitmentTransaction this_arg_conv;
40790 this_arg_conv.inner = (void*)(this_arg & (~1));
40791 this_arg_conv.is_owned = false;
40792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40793 LDKDirectedChannelTransactionParameters channel_parameters_conv;
40794 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
40795 channel_parameters_conv.is_owned = false;
40796 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40797 LDKChannelPublicKeys broadcaster_keys_conv;
40798 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
40799 broadcaster_keys_conv.is_owned = false;
40800 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
40801 LDKChannelPublicKeys countersignatory_keys_conv;
40802 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
40803 countersignatory_keys_conv.is_owned = false;
40804 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
40805 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
40806 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
40807 return (int64_t)ret_conv;
40810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40811 LDKTrustedCommitmentTransaction this_obj_conv;
40812 this_obj_conv.inner = (void*)(this_obj & (~1));
40813 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40815 TrustedCommitmentTransaction_free(this_obj_conv);
40818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
40819 LDKTrustedCommitmentTransaction this_arg_conv;
40820 this_arg_conv.inner = (void*)(this_arg & (~1));
40821 this_arg_conv.is_owned = false;
40822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40823 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40824 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
40828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
40829 LDKTrustedCommitmentTransaction this_arg_conv;
40830 this_arg_conv.inner = (void*)(this_arg & (~1));
40831 this_arg_conv.is_owned = false;
40832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40833 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
40834 int64_t ret_ref = 0;
40835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40838 ret_ref = (uintptr_t)ret_var.inner;
40839 if (ret_var.is_owned) {
40845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
40846 LDKTrustedCommitmentTransaction this_arg_conv;
40847 this_arg_conv.inner = (void*)(this_arg & (~1));
40848 this_arg_conv.is_owned = false;
40849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40850 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
40851 int64_t ret_ref = 0;
40852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40855 ret_ref = (uintptr_t)ret_var.inner;
40856 if (ret_var.is_owned) {
40862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
40863 LDKTrustedCommitmentTransaction this_arg_conv;
40864 this_arg_conv.inner = (void*)(this_arg & (~1));
40865 this_arg_conv.is_owned = false;
40866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40867 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
40871 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) {
40872 LDKTrustedCommitmentTransaction this_arg_conv;
40873 this_arg_conv.inner = (void*)(this_arg & (~1));
40874 this_arg_conv.is_owned = false;
40875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40876 unsigned char htlc_base_key_arr[32];
40877 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
40878 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
40879 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
40880 LDKDirectedChannelTransactionParameters channel_parameters_conv;
40881 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
40882 channel_parameters_conv.is_owned = false;
40883 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
40884 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
40885 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
40886 return (int64_t)ret_conv;
40889 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) {
40890 LDKPublicKey broadcaster_payment_basepoint_ref;
40891 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
40892 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
40893 LDKPublicKey countersignatory_payment_basepoint_ref;
40894 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
40895 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
40896 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
40900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40901 LDKInitFeatures a_conv;
40902 a_conv.inner = (void*)(a & (~1));
40903 a_conv.is_owned = false;
40904 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40905 LDKInitFeatures b_conv;
40906 b_conv.inner = (void*)(b & (~1));
40907 b_conv.is_owned = false;
40908 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40909 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
40913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40914 LDKNodeFeatures a_conv;
40915 a_conv.inner = (void*)(a & (~1));
40916 a_conv.is_owned = false;
40917 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40918 LDKNodeFeatures b_conv;
40919 b_conv.inner = (void*)(b & (~1));
40920 b_conv.is_owned = false;
40921 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40922 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
40926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40927 LDKChannelFeatures a_conv;
40928 a_conv.inner = (void*)(a & (~1));
40929 a_conv.is_owned = false;
40930 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40931 LDKChannelFeatures b_conv;
40932 b_conv.inner = (void*)(b & (~1));
40933 b_conv.is_owned = false;
40934 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40935 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
40939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40940 LDKInvoiceFeatures a_conv;
40941 a_conv.inner = (void*)(a & (~1));
40942 a_conv.is_owned = false;
40943 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40944 LDKInvoiceFeatures b_conv;
40945 b_conv.inner = (void*)(b & (~1));
40946 b_conv.is_owned = false;
40947 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40948 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
40952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40953 LDKChannelTypeFeatures a_conv;
40954 a_conv.inner = (void*)(a & (~1));
40955 a_conv.is_owned = false;
40956 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40957 LDKChannelTypeFeatures b_conv;
40958 b_conv.inner = (void*)(b & (~1));
40959 b_conv.is_owned = false;
40960 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40961 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
40965 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
40966 LDKInitFeatures ret_var = InitFeatures_clone(arg);
40967 int64_t ret_ref = 0;
40968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40971 ret_ref = (uintptr_t)ret_var.inner;
40972 if (ret_var.is_owned) {
40977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40978 LDKInitFeatures arg_conv;
40979 arg_conv.inner = (void*)(arg & (~1));
40980 arg_conv.is_owned = false;
40981 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40982 int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
40986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40987 LDKInitFeatures orig_conv;
40988 orig_conv.inner = (void*)(orig & (~1));
40989 orig_conv.is_owned = false;
40990 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40991 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
40992 int64_t ret_ref = 0;
40993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40996 ret_ref = (uintptr_t)ret_var.inner;
40997 if (ret_var.is_owned) {
41003 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
41004 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
41005 int64_t ret_ref = 0;
41006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41009 ret_ref = (uintptr_t)ret_var.inner;
41010 if (ret_var.is_owned) {
41015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41016 LDKNodeFeatures arg_conv;
41017 arg_conv.inner = (void*)(arg & (~1));
41018 arg_conv.is_owned = false;
41019 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41020 int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
41024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41025 LDKNodeFeatures orig_conv;
41026 orig_conv.inner = (void*)(orig & (~1));
41027 orig_conv.is_owned = false;
41028 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41029 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
41030 int64_t ret_ref = 0;
41031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41034 ret_ref = (uintptr_t)ret_var.inner;
41035 if (ret_var.is_owned) {
41041 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
41042 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
41043 int64_t ret_ref = 0;
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) {
41053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41054 LDKChannelFeatures arg_conv;
41055 arg_conv.inner = (void*)(arg & (~1));
41056 arg_conv.is_owned = false;
41057 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41058 int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
41062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41063 LDKChannelFeatures orig_conv;
41064 orig_conv.inner = (void*)(orig & (~1));
41065 orig_conv.is_owned = false;
41066 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41067 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
41068 int64_t ret_ref = 0;
41069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41072 ret_ref = (uintptr_t)ret_var.inner;
41073 if (ret_var.is_owned) {
41079 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
41080 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
41081 int64_t ret_ref = 0;
41082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41085 ret_ref = (uintptr_t)ret_var.inner;
41086 if (ret_var.is_owned) {
41091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41092 LDKInvoiceFeatures arg_conv;
41093 arg_conv.inner = (void*)(arg & (~1));
41094 arg_conv.is_owned = false;
41095 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41096 int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
41100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41101 LDKInvoiceFeatures orig_conv;
41102 orig_conv.inner = (void*)(orig & (~1));
41103 orig_conv.is_owned = false;
41104 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41105 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
41106 int64_t ret_ref = 0;
41107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41110 ret_ref = (uintptr_t)ret_var.inner;
41111 if (ret_var.is_owned) {
41117 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
41118 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
41119 int64_t ret_ref = 0;
41120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41123 ret_ref = (uintptr_t)ret_var.inner;
41124 if (ret_var.is_owned) {
41129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41130 LDKChannelTypeFeatures arg_conv;
41131 arg_conv.inner = (void*)(arg & (~1));
41132 arg_conv.is_owned = false;
41133 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41134 int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
41138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41139 LDKChannelTypeFeatures orig_conv;
41140 orig_conv.inner = (void*)(orig & (~1));
41141 orig_conv.is_owned = false;
41142 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41143 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
41144 int64_t ret_ref = 0;
41145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41148 ret_ref = (uintptr_t)ret_var.inner;
41149 if (ret_var.is_owned) {
41155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41156 LDKInitFeatures this_obj_conv;
41157 this_obj_conv.inner = (void*)(this_obj & (~1));
41158 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41160 InitFeatures_free(this_obj_conv);
41163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41164 LDKNodeFeatures this_obj_conv;
41165 this_obj_conv.inner = (void*)(this_obj & (~1));
41166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41168 NodeFeatures_free(this_obj_conv);
41171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41172 LDKChannelFeatures this_obj_conv;
41173 this_obj_conv.inner = (void*)(this_obj & (~1));
41174 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41176 ChannelFeatures_free(this_obj_conv);
41179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41180 LDKInvoiceFeatures this_obj_conv;
41181 this_obj_conv.inner = (void*)(this_obj & (~1));
41182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41184 InvoiceFeatures_free(this_obj_conv);
41187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41188 LDKChannelTypeFeatures this_obj_conv;
41189 this_obj_conv.inner = (void*)(this_obj & (~1));
41190 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41192 ChannelTypeFeatures_free(this_obj_conv);
41195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
41196 LDKInitFeatures ret_var = InitFeatures_empty();
41197 int64_t ret_ref = 0;
41198 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41199 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41201 ret_ref = (uintptr_t)ret_var.inner;
41202 if (ret_var.is_owned) {
41208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
41209 LDKInitFeatures ret_var = InitFeatures_known();
41210 int64_t ret_ref = 0;
41211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41214 ret_ref = (uintptr_t)ret_var.inner;
41215 if (ret_var.is_owned) {
41221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41222 LDKInitFeatures this_arg_conv;
41223 this_arg_conv.inner = (void*)(this_arg & (~1));
41224 this_arg_conv.is_owned = false;
41225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41226 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
41230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
41231 LDKNodeFeatures ret_var = NodeFeatures_empty();
41232 int64_t ret_ref = 0;
41233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41236 ret_ref = (uintptr_t)ret_var.inner;
41237 if (ret_var.is_owned) {
41243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
41244 LDKNodeFeatures ret_var = NodeFeatures_known();
41245 int64_t ret_ref = 0;
41246 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41247 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41249 ret_ref = (uintptr_t)ret_var.inner;
41250 if (ret_var.is_owned) {
41256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41257 LDKNodeFeatures this_arg_conv;
41258 this_arg_conv.inner = (void*)(this_arg & (~1));
41259 this_arg_conv.is_owned = false;
41260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41261 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
41265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
41266 LDKChannelFeatures ret_var = ChannelFeatures_empty();
41267 int64_t ret_ref = 0;
41268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41271 ret_ref = (uintptr_t)ret_var.inner;
41272 if (ret_var.is_owned) {
41278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
41279 LDKChannelFeatures ret_var = ChannelFeatures_known();
41280 int64_t ret_ref = 0;
41281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41284 ret_ref = (uintptr_t)ret_var.inner;
41285 if (ret_var.is_owned) {
41291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41292 LDKChannelFeatures this_arg_conv;
41293 this_arg_conv.inner = (void*)(this_arg & (~1));
41294 this_arg_conv.is_owned = false;
41295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41296 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
41300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
41301 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
41302 int64_t ret_ref = 0;
41303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41306 ret_ref = (uintptr_t)ret_var.inner;
41307 if (ret_var.is_owned) {
41313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
41314 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
41315 int64_t ret_ref = 0;
41316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41319 ret_ref = (uintptr_t)ret_var.inner;
41320 if (ret_var.is_owned) {
41326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41327 LDKInvoiceFeatures this_arg_conv;
41328 this_arg_conv.inner = (void*)(this_arg & (~1));
41329 this_arg_conv.is_owned = false;
41330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41331 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
41335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
41336 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
41337 int64_t ret_ref = 0;
41338 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41339 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41341 ret_ref = (uintptr_t)ret_var.inner;
41342 if (ret_var.is_owned) {
41348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
41349 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
41350 int64_t ret_ref = 0;
41351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41354 ret_ref = (uintptr_t)ret_var.inner;
41355 if (ret_var.is_owned) {
41361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41362 LDKChannelTypeFeatures this_arg_conv;
41363 this_arg_conv.inner = (void*)(this_arg & (~1));
41364 this_arg_conv.is_owned = false;
41365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41366 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
41370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41371 LDKInitFeatures obj_conv;
41372 obj_conv.inner = (void*)(obj & (~1));
41373 obj_conv.is_owned = false;
41374 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41375 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
41376 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41377 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41378 CVec_u8Z_free(ret_var);
41382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41383 LDKu8slice ser_ref;
41384 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41385 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41386 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
41387 *ret_conv = InitFeatures_read(ser_ref);
41388 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41389 return (int64_t)ret_conv;
41392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41393 LDKChannelFeatures obj_conv;
41394 obj_conv.inner = (void*)(obj & (~1));
41395 obj_conv.is_owned = false;
41396 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41397 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
41398 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41399 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41400 CVec_u8Z_free(ret_var);
41404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41405 LDKu8slice ser_ref;
41406 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41407 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41408 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
41409 *ret_conv = ChannelFeatures_read(ser_ref);
41410 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41411 return (int64_t)ret_conv;
41414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41415 LDKNodeFeatures obj_conv;
41416 obj_conv.inner = (void*)(obj & (~1));
41417 obj_conv.is_owned = false;
41418 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41419 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
41420 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41421 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41422 CVec_u8Z_free(ret_var);
41426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41427 LDKu8slice ser_ref;
41428 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41429 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41430 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
41431 *ret_conv = NodeFeatures_read(ser_ref);
41432 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41433 return (int64_t)ret_conv;
41436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41437 LDKInvoiceFeatures obj_conv;
41438 obj_conv.inner = (void*)(obj & (~1));
41439 obj_conv.is_owned = false;
41440 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41441 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
41442 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41443 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41444 CVec_u8Z_free(ret_var);
41448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41449 LDKu8slice ser_ref;
41450 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41451 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41452 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
41453 *ret_conv = InvoiceFeatures_read(ser_ref);
41454 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41455 return (int64_t)ret_conv;
41458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41459 LDKChannelTypeFeatures obj_conv;
41460 obj_conv.inner = (void*)(obj & (~1));
41461 obj_conv.is_owned = false;
41462 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41463 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
41464 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41465 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41466 CVec_u8Z_free(ret_var);
41470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41471 LDKu8slice ser_ref;
41472 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41473 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41474 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
41475 *ret_conv = ChannelTypeFeatures_read(ser_ref);
41476 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41477 return (int64_t)ret_conv;
41480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41481 LDKInitFeatures this_arg_conv;
41482 this_arg_conv.inner = (void*)(this_arg & (~1));
41483 this_arg_conv.is_owned = false;
41484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41485 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
41488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41489 LDKInitFeatures this_arg_conv;
41490 this_arg_conv.inner = (void*)(this_arg & (~1));
41491 this_arg_conv.is_owned = false;
41492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41493 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
41496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41497 LDKInitFeatures this_arg_conv;
41498 this_arg_conv.inner = (void*)(this_arg & (~1));
41499 this_arg_conv.is_owned = false;
41500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41501 jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
41505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41506 LDKNodeFeatures this_arg_conv;
41507 this_arg_conv.inner = (void*)(this_arg & (~1));
41508 this_arg_conv.is_owned = false;
41509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41510 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
41513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41514 LDKNodeFeatures this_arg_conv;
41515 this_arg_conv.inner = (void*)(this_arg & (~1));
41516 this_arg_conv.is_owned = false;
41517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41518 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
41521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41522 LDKNodeFeatures this_arg_conv;
41523 this_arg_conv.inner = (void*)(this_arg & (~1));
41524 this_arg_conv.is_owned = false;
41525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41526 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
41530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41531 LDKInitFeatures this_arg_conv;
41532 this_arg_conv.inner = (void*)(this_arg & (~1));
41533 this_arg_conv.is_owned = false;
41534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41535 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
41539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41540 LDKNodeFeatures this_arg_conv;
41541 this_arg_conv.inner = (void*)(this_arg & (~1));
41542 this_arg_conv.is_owned = false;
41543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41544 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
41548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41549 LDKInitFeatures this_arg_conv;
41550 this_arg_conv.inner = (void*)(this_arg & (~1));
41551 this_arg_conv.is_owned = false;
41552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41553 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
41556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41557 LDKInitFeatures this_arg_conv;
41558 this_arg_conv.inner = (void*)(this_arg & (~1));
41559 this_arg_conv.is_owned = false;
41560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41561 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
41564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
41565 LDKInitFeatures this_arg_conv;
41566 this_arg_conv.inner = (void*)(this_arg & (~1));
41567 this_arg_conv.is_owned = false;
41568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41569 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
41573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41574 LDKInitFeatures this_arg_conv;
41575 this_arg_conv.inner = (void*)(this_arg & (~1));
41576 this_arg_conv.is_owned = false;
41577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41578 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41582 LDKInitFeatures this_arg_conv;
41583 this_arg_conv.inner = (void*)(this_arg & (~1));
41584 this_arg_conv.is_owned = false;
41585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41586 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41590 LDKInitFeatures this_arg_conv;
41591 this_arg_conv.inner = (void*)(this_arg & (~1));
41592 this_arg_conv.is_owned = false;
41593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41594 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41599 LDKNodeFeatures this_arg_conv;
41600 this_arg_conv.inner = (void*)(this_arg & (~1));
41601 this_arg_conv.is_owned = false;
41602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41603 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41607 LDKNodeFeatures this_arg_conv;
41608 this_arg_conv.inner = (void*)(this_arg & (~1));
41609 this_arg_conv.is_owned = false;
41610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41611 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41615 LDKNodeFeatures this_arg_conv;
41616 this_arg_conv.inner = (void*)(this_arg & (~1));
41617 this_arg_conv.is_owned = false;
41618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41619 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41624 LDKInitFeatures this_arg_conv;
41625 this_arg_conv.inner = (void*)(this_arg & (~1));
41626 this_arg_conv.is_owned = false;
41627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41628 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41633 LDKNodeFeatures this_arg_conv;
41634 this_arg_conv.inner = (void*)(this_arg & (~1));
41635 this_arg_conv.is_owned = false;
41636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41637 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41642 LDKInitFeatures this_arg_conv;
41643 this_arg_conv.inner = (void*)(this_arg & (~1));
41644 this_arg_conv.is_owned = false;
41645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41646 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
41649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41650 LDKInitFeatures this_arg_conv;
41651 this_arg_conv.inner = (void*)(this_arg & (~1));
41652 this_arg_conv.is_owned = false;
41653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41654 InitFeatures_set_gossip_queries_required(&this_arg_conv);
41657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41658 LDKInitFeatures this_arg_conv;
41659 this_arg_conv.inner = (void*)(this_arg & (~1));
41660 this_arg_conv.is_owned = false;
41661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41662 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41667 LDKNodeFeatures this_arg_conv;
41668 this_arg_conv.inner = (void*)(this_arg & (~1));
41669 this_arg_conv.is_owned = false;
41670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41671 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41675 LDKNodeFeatures this_arg_conv;
41676 this_arg_conv.inner = (void*)(this_arg & (~1));
41677 this_arg_conv.is_owned = false;
41678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41679 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
41682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41683 LDKNodeFeatures this_arg_conv;
41684 this_arg_conv.inner = (void*)(this_arg & (~1));
41685 this_arg_conv.is_owned = false;
41686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41687 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
41691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41692 LDKInitFeatures this_arg_conv;
41693 this_arg_conv.inner = (void*)(this_arg & (~1));
41694 this_arg_conv.is_owned = false;
41695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41696 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
41700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41701 LDKNodeFeatures this_arg_conv;
41702 this_arg_conv.inner = (void*)(this_arg & (~1));
41703 this_arg_conv.is_owned = false;
41704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41705 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
41709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41710 LDKInitFeatures this_arg_conv;
41711 this_arg_conv.inner = (void*)(this_arg & (~1));
41712 this_arg_conv.is_owned = false;
41713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41714 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
41717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41718 LDKInitFeatures this_arg_conv;
41719 this_arg_conv.inner = (void*)(this_arg & (~1));
41720 this_arg_conv.is_owned = false;
41721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41722 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
41725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41726 LDKInitFeatures this_arg_conv;
41727 this_arg_conv.inner = (void*)(this_arg & (~1));
41728 this_arg_conv.is_owned = false;
41729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41730 jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
41734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41735 LDKNodeFeatures this_arg_conv;
41736 this_arg_conv.inner = (void*)(this_arg & (~1));
41737 this_arg_conv.is_owned = false;
41738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41739 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
41742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41743 LDKNodeFeatures this_arg_conv;
41744 this_arg_conv.inner = (void*)(this_arg & (~1));
41745 this_arg_conv.is_owned = false;
41746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41747 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
41750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41751 LDKNodeFeatures this_arg_conv;
41752 this_arg_conv.inner = (void*)(this_arg & (~1));
41753 this_arg_conv.is_owned = false;
41754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41755 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
41759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41760 LDKInvoiceFeatures this_arg_conv;
41761 this_arg_conv.inner = (void*)(this_arg & (~1));
41762 this_arg_conv.is_owned = false;
41763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41764 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
41767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41768 LDKInvoiceFeatures this_arg_conv;
41769 this_arg_conv.inner = (void*)(this_arg & (~1));
41770 this_arg_conv.is_owned = false;
41771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41772 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
41775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41776 LDKInvoiceFeatures this_arg_conv;
41777 this_arg_conv.inner = (void*)(this_arg & (~1));
41778 this_arg_conv.is_owned = false;
41779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41780 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
41784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41785 LDKInitFeatures this_arg_conv;
41786 this_arg_conv.inner = (void*)(this_arg & (~1));
41787 this_arg_conv.is_owned = false;
41788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41789 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
41793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41794 LDKNodeFeatures this_arg_conv;
41795 this_arg_conv.inner = (void*)(this_arg & (~1));
41796 this_arg_conv.is_owned = false;
41797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41798 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
41802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
41803 LDKInvoiceFeatures this_arg_conv;
41804 this_arg_conv.inner = (void*)(this_arg & (~1));
41805 this_arg_conv.is_owned = false;
41806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41807 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
41811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41812 LDKInitFeatures this_arg_conv;
41813 this_arg_conv.inner = (void*)(this_arg & (~1));
41814 this_arg_conv.is_owned = false;
41815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41816 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
41819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41820 LDKInitFeatures this_arg_conv;
41821 this_arg_conv.inner = (void*)(this_arg & (~1));
41822 this_arg_conv.is_owned = false;
41823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41824 InitFeatures_set_static_remote_key_required(&this_arg_conv);
41827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41828 LDKInitFeatures this_arg_conv;
41829 this_arg_conv.inner = (void*)(this_arg & (~1));
41830 this_arg_conv.is_owned = false;
41831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41832 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
41836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41837 LDKNodeFeatures this_arg_conv;
41838 this_arg_conv.inner = (void*)(this_arg & (~1));
41839 this_arg_conv.is_owned = false;
41840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41841 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
41844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41845 LDKNodeFeatures this_arg_conv;
41846 this_arg_conv.inner = (void*)(this_arg & (~1));
41847 this_arg_conv.is_owned = false;
41848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41849 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
41852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41853 LDKNodeFeatures this_arg_conv;
41854 this_arg_conv.inner = (void*)(this_arg & (~1));
41855 this_arg_conv.is_owned = false;
41856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41857 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
41861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41862 LDKChannelTypeFeatures this_arg_conv;
41863 this_arg_conv.inner = (void*)(this_arg & (~1));
41864 this_arg_conv.is_owned = false;
41865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41866 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
41869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41870 LDKChannelTypeFeatures this_arg_conv;
41871 this_arg_conv.inner = (void*)(this_arg & (~1));
41872 this_arg_conv.is_owned = false;
41873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41874 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
41877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41878 LDKChannelTypeFeatures 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 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
41886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41887 LDKInitFeatures this_arg_conv;
41888 this_arg_conv.inner = (void*)(this_arg & (~1));
41889 this_arg_conv.is_owned = false;
41890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41891 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
41895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41896 LDKNodeFeatures this_arg_conv;
41897 this_arg_conv.inner = (void*)(this_arg & (~1));
41898 this_arg_conv.is_owned = false;
41899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41900 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
41904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41905 LDKChannelTypeFeatures this_arg_conv;
41906 this_arg_conv.inner = (void*)(this_arg & (~1));
41907 this_arg_conv.is_owned = false;
41908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41909 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
41913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41914 LDKInitFeatures this_arg_conv;
41915 this_arg_conv.inner = (void*)(this_arg & (~1));
41916 this_arg_conv.is_owned = false;
41917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41918 InitFeatures_set_payment_secret_optional(&this_arg_conv);
41921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41922 LDKInitFeatures this_arg_conv;
41923 this_arg_conv.inner = (void*)(this_arg & (~1));
41924 this_arg_conv.is_owned = false;
41925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41926 InitFeatures_set_payment_secret_required(&this_arg_conv);
41929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41930 LDKInitFeatures this_arg_conv;
41931 this_arg_conv.inner = (void*)(this_arg & (~1));
41932 this_arg_conv.is_owned = false;
41933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41934 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
41938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41939 LDKNodeFeatures this_arg_conv;
41940 this_arg_conv.inner = (void*)(this_arg & (~1));
41941 this_arg_conv.is_owned = false;
41942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41943 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
41946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41947 LDKNodeFeatures this_arg_conv;
41948 this_arg_conv.inner = (void*)(this_arg & (~1));
41949 this_arg_conv.is_owned = false;
41950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41951 NodeFeatures_set_payment_secret_required(&this_arg_conv);
41954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41955 LDKNodeFeatures this_arg_conv;
41956 this_arg_conv.inner = (void*)(this_arg & (~1));
41957 this_arg_conv.is_owned = false;
41958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41959 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
41963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41964 LDKInvoiceFeatures this_arg_conv;
41965 this_arg_conv.inner = (void*)(this_arg & (~1));
41966 this_arg_conv.is_owned = false;
41967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41968 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
41971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41972 LDKInvoiceFeatures this_arg_conv;
41973 this_arg_conv.inner = (void*)(this_arg & (~1));
41974 this_arg_conv.is_owned = false;
41975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41976 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
41979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41980 LDKInvoiceFeatures this_arg_conv;
41981 this_arg_conv.inner = (void*)(this_arg & (~1));
41982 this_arg_conv.is_owned = false;
41983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41984 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
41988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41989 LDKInitFeatures this_arg_conv;
41990 this_arg_conv.inner = (void*)(this_arg & (~1));
41991 this_arg_conv.is_owned = false;
41992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41993 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
41997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41998 LDKNodeFeatures this_arg_conv;
41999 this_arg_conv.inner = (void*)(this_arg & (~1));
42000 this_arg_conv.is_owned = false;
42001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42002 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
42006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42007 LDKInvoiceFeatures this_arg_conv;
42008 this_arg_conv.inner = (void*)(this_arg & (~1));
42009 this_arg_conv.is_owned = false;
42010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42011 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
42015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42016 LDKInitFeatures this_arg_conv;
42017 this_arg_conv.inner = (void*)(this_arg & (~1));
42018 this_arg_conv.is_owned = false;
42019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42020 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
42023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42024 LDKInitFeatures this_arg_conv;
42025 this_arg_conv.inner = (void*)(this_arg & (~1));
42026 this_arg_conv.is_owned = false;
42027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42028 InitFeatures_set_basic_mpp_required(&this_arg_conv);
42031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42032 LDKInitFeatures this_arg_conv;
42033 this_arg_conv.inner = (void*)(this_arg & (~1));
42034 this_arg_conv.is_owned = false;
42035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42036 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
42040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42041 LDKNodeFeatures this_arg_conv;
42042 this_arg_conv.inner = (void*)(this_arg & (~1));
42043 this_arg_conv.is_owned = false;
42044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42045 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
42048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42049 LDKNodeFeatures this_arg_conv;
42050 this_arg_conv.inner = (void*)(this_arg & (~1));
42051 this_arg_conv.is_owned = false;
42052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42053 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
42056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42057 LDKNodeFeatures this_arg_conv;
42058 this_arg_conv.inner = (void*)(this_arg & (~1));
42059 this_arg_conv.is_owned = false;
42060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42061 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
42065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42066 LDKInvoiceFeatures this_arg_conv;
42067 this_arg_conv.inner = (void*)(this_arg & (~1));
42068 this_arg_conv.is_owned = false;
42069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42070 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
42073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42074 LDKInvoiceFeatures this_arg_conv;
42075 this_arg_conv.inner = (void*)(this_arg & (~1));
42076 this_arg_conv.is_owned = false;
42077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42078 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
42081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42082 LDKInvoiceFeatures this_arg_conv;
42083 this_arg_conv.inner = (void*)(this_arg & (~1));
42084 this_arg_conv.is_owned = false;
42085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42086 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
42090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42091 LDKInitFeatures this_arg_conv;
42092 this_arg_conv.inner = (void*)(this_arg & (~1));
42093 this_arg_conv.is_owned = false;
42094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42095 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
42099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42100 LDKNodeFeatures this_arg_conv;
42101 this_arg_conv.inner = (void*)(this_arg & (~1));
42102 this_arg_conv.is_owned = false;
42103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42104 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
42108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42109 LDKInvoiceFeatures this_arg_conv;
42110 this_arg_conv.inner = (void*)(this_arg & (~1));
42111 this_arg_conv.is_owned = false;
42112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42113 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
42117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42118 LDKInitFeatures this_arg_conv;
42119 this_arg_conv.inner = (void*)(this_arg & (~1));
42120 this_arg_conv.is_owned = false;
42121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42122 InitFeatures_set_wumbo_optional(&this_arg_conv);
42125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42126 LDKInitFeatures this_arg_conv;
42127 this_arg_conv.inner = (void*)(this_arg & (~1));
42128 this_arg_conv.is_owned = false;
42129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42130 InitFeatures_set_wumbo_required(&this_arg_conv);
42133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42134 LDKInitFeatures this_arg_conv;
42135 this_arg_conv.inner = (void*)(this_arg & (~1));
42136 this_arg_conv.is_owned = false;
42137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42138 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
42142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42143 LDKNodeFeatures this_arg_conv;
42144 this_arg_conv.inner = (void*)(this_arg & (~1));
42145 this_arg_conv.is_owned = false;
42146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42147 NodeFeatures_set_wumbo_optional(&this_arg_conv);
42150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42151 LDKNodeFeatures this_arg_conv;
42152 this_arg_conv.inner = (void*)(this_arg & (~1));
42153 this_arg_conv.is_owned = false;
42154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42155 NodeFeatures_set_wumbo_required(&this_arg_conv);
42158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42159 LDKNodeFeatures this_arg_conv;
42160 this_arg_conv.inner = (void*)(this_arg & (~1));
42161 this_arg_conv.is_owned = false;
42162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42163 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
42167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42168 LDKInitFeatures this_arg_conv;
42169 this_arg_conv.inner = (void*)(this_arg & (~1));
42170 this_arg_conv.is_owned = false;
42171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42172 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
42176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42177 LDKNodeFeatures this_arg_conv;
42178 this_arg_conv.inner = (void*)(this_arg & (~1));
42179 this_arg_conv.is_owned = false;
42180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42181 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
42185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42186 LDKInitFeatures this_arg_conv;
42187 this_arg_conv.inner = (void*)(this_arg & (~1));
42188 this_arg_conv.is_owned = false;
42189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42190 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
42193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42194 LDKInitFeatures this_arg_conv;
42195 this_arg_conv.inner = (void*)(this_arg & (~1));
42196 this_arg_conv.is_owned = false;
42197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42198 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
42201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42202 LDKInitFeatures this_arg_conv;
42203 this_arg_conv.inner = (void*)(this_arg & (~1));
42204 this_arg_conv.is_owned = false;
42205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42206 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
42210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42211 LDKNodeFeatures this_arg_conv;
42212 this_arg_conv.inner = (void*)(this_arg & (~1));
42213 this_arg_conv.is_owned = false;
42214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42215 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
42218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42219 LDKNodeFeatures this_arg_conv;
42220 this_arg_conv.inner = (void*)(this_arg & (~1));
42221 this_arg_conv.is_owned = false;
42222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42223 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
42226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42227 LDKNodeFeatures this_arg_conv;
42228 this_arg_conv.inner = (void*)(this_arg & (~1));
42229 this_arg_conv.is_owned = false;
42230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42231 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
42235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42236 LDKInitFeatures this_arg_conv;
42237 this_arg_conv.inner = (void*)(this_arg & (~1));
42238 this_arg_conv.is_owned = false;
42239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42240 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
42244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42245 LDKNodeFeatures this_arg_conv;
42246 this_arg_conv.inner = (void*)(this_arg & (~1));
42247 this_arg_conv.is_owned = false;
42248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42249 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
42253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42254 LDKInitFeatures this_arg_conv;
42255 this_arg_conv.inner = (void*)(this_arg & (~1));
42256 this_arg_conv.is_owned = false;
42257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42258 InitFeatures_set_channel_type_optional(&this_arg_conv);
42261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42262 LDKInitFeatures this_arg_conv;
42263 this_arg_conv.inner = (void*)(this_arg & (~1));
42264 this_arg_conv.is_owned = false;
42265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42266 InitFeatures_set_channel_type_required(&this_arg_conv);
42269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42270 LDKInitFeatures this_arg_conv;
42271 this_arg_conv.inner = (void*)(this_arg & (~1));
42272 this_arg_conv.is_owned = false;
42273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42274 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
42278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42279 LDKNodeFeatures this_arg_conv;
42280 this_arg_conv.inner = (void*)(this_arg & (~1));
42281 this_arg_conv.is_owned = false;
42282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42283 NodeFeatures_set_channel_type_optional(&this_arg_conv);
42286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42287 LDKNodeFeatures this_arg_conv;
42288 this_arg_conv.inner = (void*)(this_arg & (~1));
42289 this_arg_conv.is_owned = false;
42290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42291 NodeFeatures_set_channel_type_required(&this_arg_conv);
42294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42295 LDKNodeFeatures this_arg_conv;
42296 this_arg_conv.inner = (void*)(this_arg & (~1));
42297 this_arg_conv.is_owned = false;
42298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42299 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
42303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42304 LDKInitFeatures this_arg_conv;
42305 this_arg_conv.inner = (void*)(this_arg & (~1));
42306 this_arg_conv.is_owned = false;
42307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42308 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
42312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42313 LDKNodeFeatures this_arg_conv;
42314 this_arg_conv.inner = (void*)(this_arg & (~1));
42315 this_arg_conv.is_owned = false;
42316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42317 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
42321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42322 LDKInitFeatures this_arg_conv;
42323 this_arg_conv.inner = (void*)(this_arg & (~1));
42324 this_arg_conv.is_owned = false;
42325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42326 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
42329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42330 LDKInitFeatures this_arg_conv;
42331 this_arg_conv.inner = (void*)(this_arg & (~1));
42332 this_arg_conv.is_owned = false;
42333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42334 InitFeatures_set_scid_privacy_required(&this_arg_conv);
42337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42338 LDKInitFeatures this_arg_conv;
42339 this_arg_conv.inner = (void*)(this_arg & (~1));
42340 this_arg_conv.is_owned = false;
42341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42342 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42347 LDKNodeFeatures this_arg_conv;
42348 this_arg_conv.inner = (void*)(this_arg & (~1));
42349 this_arg_conv.is_owned = false;
42350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42351 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42355 LDKNodeFeatures this_arg_conv;
42356 this_arg_conv.inner = (void*)(this_arg & (~1));
42357 this_arg_conv.is_owned = false;
42358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42359 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42363 LDKNodeFeatures this_arg_conv;
42364 this_arg_conv.inner = (void*)(this_arg & (~1));
42365 this_arg_conv.is_owned = false;
42366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42367 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42372 LDKChannelTypeFeatures this_arg_conv;
42373 this_arg_conv.inner = (void*)(this_arg & (~1));
42374 this_arg_conv.is_owned = false;
42375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42376 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42380 LDKChannelTypeFeatures this_arg_conv;
42381 this_arg_conv.inner = (void*)(this_arg & (~1));
42382 this_arg_conv.is_owned = false;
42383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42384 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42388 LDKChannelTypeFeatures this_arg_conv;
42389 this_arg_conv.inner = (void*)(this_arg & (~1));
42390 this_arg_conv.is_owned = false;
42391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42392 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42397 LDKInitFeatures this_arg_conv;
42398 this_arg_conv.inner = (void*)(this_arg & (~1));
42399 this_arg_conv.is_owned = false;
42400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42401 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42406 LDKNodeFeatures this_arg_conv;
42407 this_arg_conv.inner = (void*)(this_arg & (~1));
42408 this_arg_conv.is_owned = false;
42409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42410 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42415 LDKChannelTypeFeatures this_arg_conv;
42416 this_arg_conv.inner = (void*)(this_arg & (~1));
42417 this_arg_conv.is_owned = false;
42418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42419 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42424 LDKInitFeatures this_arg_conv;
42425 this_arg_conv.inner = (void*)(this_arg & (~1));
42426 this_arg_conv.is_owned = false;
42427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42428 InitFeatures_set_zero_conf_optional(&this_arg_conv);
42431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42432 LDKInitFeatures this_arg_conv;
42433 this_arg_conv.inner = (void*)(this_arg & (~1));
42434 this_arg_conv.is_owned = false;
42435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42436 InitFeatures_set_zero_conf_required(&this_arg_conv);
42439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42440 LDKInitFeatures this_arg_conv;
42441 this_arg_conv.inner = (void*)(this_arg & (~1));
42442 this_arg_conv.is_owned = false;
42443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42444 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42449 LDKNodeFeatures this_arg_conv;
42450 this_arg_conv.inner = (void*)(this_arg & (~1));
42451 this_arg_conv.is_owned = false;
42452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42453 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42457 LDKNodeFeatures this_arg_conv;
42458 this_arg_conv.inner = (void*)(this_arg & (~1));
42459 this_arg_conv.is_owned = false;
42460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42461 NodeFeatures_set_zero_conf_required(&this_arg_conv);
42464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42465 LDKNodeFeatures this_arg_conv;
42466 this_arg_conv.inner = (void*)(this_arg & (~1));
42467 this_arg_conv.is_owned = false;
42468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42469 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42474 LDKChannelTypeFeatures this_arg_conv;
42475 this_arg_conv.inner = (void*)(this_arg & (~1));
42476 this_arg_conv.is_owned = false;
42477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42478 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42482 LDKChannelTypeFeatures this_arg_conv;
42483 this_arg_conv.inner = (void*)(this_arg & (~1));
42484 this_arg_conv.is_owned = false;
42485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42486 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42490 LDKChannelTypeFeatures this_arg_conv;
42491 this_arg_conv.inner = (void*)(this_arg & (~1));
42492 this_arg_conv.is_owned = false;
42493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42494 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42499 LDKInitFeatures this_arg_conv;
42500 this_arg_conv.inner = (void*)(this_arg & (~1));
42501 this_arg_conv.is_owned = false;
42502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42503 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
42507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42508 LDKNodeFeatures this_arg_conv;
42509 this_arg_conv.inner = (void*)(this_arg & (~1));
42510 this_arg_conv.is_owned = false;
42511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42512 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
42516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42517 LDKChannelTypeFeatures this_arg_conv;
42518 this_arg_conv.inner = (void*)(this_arg & (~1));
42519 this_arg_conv.is_owned = false;
42520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42521 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
42525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42526 LDKNodeFeatures this_arg_conv;
42527 this_arg_conv.inner = (void*)(this_arg & (~1));
42528 this_arg_conv.is_owned = false;
42529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42530 NodeFeatures_set_keysend_optional(&this_arg_conv);
42533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42534 LDKNodeFeatures this_arg_conv;
42535 this_arg_conv.inner = (void*)(this_arg & (~1));
42536 this_arg_conv.is_owned = false;
42537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42538 NodeFeatures_set_keysend_required(&this_arg_conv);
42541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
42542 LDKNodeFeatures this_arg_conv;
42543 this_arg_conv.inner = (void*)(this_arg & (~1));
42544 this_arg_conv.is_owned = false;
42545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42546 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
42550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
42551 LDKNodeFeatures this_arg_conv;
42552 this_arg_conv.inner = (void*)(this_arg & (~1));
42553 this_arg_conv.is_owned = false;
42554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42555 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
42559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42560 LDKShutdownScript this_obj_conv;
42561 this_obj_conv.inner = (void*)(this_obj & (~1));
42562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42564 ShutdownScript_free(this_obj_conv);
42567 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
42568 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
42569 int64_t ret_ref = 0;
42570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42573 ret_ref = (uintptr_t)ret_var.inner;
42574 if (ret_var.is_owned) {
42579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42580 LDKShutdownScript arg_conv;
42581 arg_conv.inner = (void*)(arg & (~1));
42582 arg_conv.is_owned = false;
42583 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42584 int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
42588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42589 LDKShutdownScript orig_conv;
42590 orig_conv.inner = (void*)(orig & (~1));
42591 orig_conv.is_owned = false;
42592 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42593 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
42594 int64_t ret_ref = 0;
42595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42598 ret_ref = (uintptr_t)ret_var.inner;
42599 if (ret_var.is_owned) {
42605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42606 LDKInvalidShutdownScript this_obj_conv;
42607 this_obj_conv.inner = (void*)(this_obj & (~1));
42608 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42610 InvalidShutdownScript_free(this_obj_conv);
42613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
42614 LDKInvalidShutdownScript 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 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
42619 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42620 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42625 LDKInvalidShutdownScript this_ptr_conv;
42626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42627 this_ptr_conv.is_owned = false;
42628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42629 LDKCVec_u8Z val_ref;
42630 val_ref.datalen = (*env)->GetArrayLength(env, val);
42631 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42632 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
42633 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
42636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
42637 LDKCVec_u8Z script_arg_ref;
42638 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
42639 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42640 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
42641 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
42642 int64_t ret_ref = 0;
42643 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42644 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42646 ret_ref = (uintptr_t)ret_var.inner;
42647 if (ret_var.is_owned) {
42653 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
42654 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
42655 int64_t ret_ref = 0;
42656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42659 ret_ref = (uintptr_t)ret_var.inner;
42660 if (ret_var.is_owned) {
42665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42666 LDKInvalidShutdownScript arg_conv;
42667 arg_conv.inner = (void*)(arg & (~1));
42668 arg_conv.is_owned = false;
42669 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42670 int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
42674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42675 LDKInvalidShutdownScript orig_conv;
42676 orig_conv.inner = (void*)(orig & (~1));
42677 orig_conv.is_owned = false;
42678 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42679 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
42680 int64_t ret_ref = 0;
42681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42684 ret_ref = (uintptr_t)ret_var.inner;
42685 if (ret_var.is_owned) {
42691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
42692 LDKShutdownScript obj_conv;
42693 obj_conv.inner = (void*)(obj & (~1));
42694 obj_conv.is_owned = false;
42695 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42696 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
42697 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42698 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42699 CVec_u8Z_free(ret_var);
42703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42704 LDKu8slice ser_ref;
42705 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42706 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42707 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
42708 *ret_conv = ShutdownScript_read(ser_ref);
42709 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42710 return (int64_t)ret_conv;
42713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
42714 unsigned char pubkey_hash_arr[20];
42715 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
42716 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
42717 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
42718 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
42719 int64_t ret_ref = 0;
42720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42723 ret_ref = (uintptr_t)ret_var.inner;
42724 if (ret_var.is_owned) {
42730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
42731 unsigned char script_hash_arr[32];
42732 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
42733 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
42734 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
42735 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
42736 int64_t ret_ref = 0;
42737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42740 ret_ref = (uintptr_t)ret_var.inner;
42741 if (ret_var.is_owned) {
42747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
42749 LDKu8slice program_ref;
42750 program_ref.datalen = (*env)->GetArrayLength(env, program);
42751 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
42752 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
42753 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
42754 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
42755 return (int64_t)ret_conv;
42758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
42759 LDKShutdownScript this_arg_conv;
42760 this_arg_conv.inner = (void*)(this_arg & (~1));
42761 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
42762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42763 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
42764 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
42765 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42766 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42767 CVec_u8Z_free(ret_var);
42771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
42772 LDKShutdownScript this_arg_conv;
42773 this_arg_conv.inner = (void*)(this_arg & (~1));
42774 this_arg_conv.is_owned = false;
42775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42776 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42777 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
42781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
42782 LDKShutdownScript this_arg_conv;
42783 this_arg_conv.inner = (void*)(this_arg & (~1));
42784 this_arg_conv.is_owned = false;
42785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42786 LDKInitFeatures features_conv;
42787 features_conv.inner = (void*)(features & (~1));
42788 features_conv.is_owned = false;
42789 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42790 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
42794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42795 if ((this_ptr & 1) != 0) return;
42796 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42797 CHECK_ACCESS(this_ptr_ptr);
42798 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
42799 FREE((void*)this_ptr);
42800 CustomMessageReader_free(this_ptr_conv);
42803 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
42804 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42805 *ret_ret = Type_clone(arg);
42806 return (int64_t)ret_ret;
42808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42809 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
42810 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
42811 LDKType* arg_conv = (LDKType*)arg_ptr;
42812 int64_t ret_conv = Type_clone_ptr(arg_conv);
42816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42817 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
42818 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
42819 LDKType* orig_conv = (LDKType*)orig_ptr;
42820 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
42821 *ret_ret = Type_clone(orig_conv);
42822 return (int64_t)ret_ret;
42825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42826 if ((this_ptr & 1) != 0) return;
42827 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42828 CHECK_ACCESS(this_ptr_ptr);
42829 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
42830 FREE((void*)this_ptr);
42831 Type_free(this_ptr_conv);
42834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42835 LDKNodeId this_obj_conv;
42836 this_obj_conv.inner = (void*)(this_obj & (~1));
42837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42839 NodeId_free(this_obj_conv);
42842 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
42843 LDKNodeId ret_var = NodeId_clone(arg);
42844 int64_t ret_ref = 0;
42845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42848 ret_ref = (uintptr_t)ret_var.inner;
42849 if (ret_var.is_owned) {
42854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42855 LDKNodeId arg_conv;
42856 arg_conv.inner = (void*)(arg & (~1));
42857 arg_conv.is_owned = false;
42858 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42859 int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
42863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42864 LDKNodeId orig_conv;
42865 orig_conv.inner = (void*)(orig & (~1));
42866 orig_conv.is_owned = false;
42867 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42868 LDKNodeId ret_var = NodeId_clone(&orig_conv);
42869 int64_t ret_ref = 0;
42870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42873 ret_ref = (uintptr_t)ret_var.inner;
42874 if (ret_var.is_owned) {
42880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
42881 LDKPublicKey pubkey_ref;
42882 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
42883 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
42884 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
42885 int64_t ret_ref = 0;
42886 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42887 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42889 ret_ref = (uintptr_t)ret_var.inner;
42890 if (ret_var.is_owned) {
42896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
42897 LDKNodeId this_arg_conv;
42898 this_arg_conv.inner = (void*)(this_arg & (~1));
42899 this_arg_conv.is_owned = false;
42900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42901 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
42902 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42903 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
42909 o_conv.inner = (void*)(o & (~1));
42910 o_conv.is_owned = false;
42911 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42912 int64_t ret_conv = NodeId_hash(&o_conv);
42916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
42917 LDKNodeId obj_conv;
42918 obj_conv.inner = (void*)(obj & (~1));
42919 obj_conv.is_owned = false;
42920 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42921 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
42922 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42923 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42924 CVec_u8Z_free(ret_var);
42928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42929 LDKu8slice ser_ref;
42930 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42931 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42932 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
42933 *ret_conv = NodeId_read(ser_ref);
42934 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42935 return (int64_t)ret_conv;
42938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42939 LDKNetworkGraph this_obj_conv;
42940 this_obj_conv.inner = (void*)(this_obj & (~1));
42941 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42943 NetworkGraph_free(this_obj_conv);
42946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42947 LDKReadOnlyNetworkGraph this_obj_conv;
42948 this_obj_conv.inner = (void*)(this_obj & (~1));
42949 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42951 ReadOnlyNetworkGraph_free(this_obj_conv);
42954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42955 if ((this_ptr & 1) != 0) return;
42956 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42957 CHECK_ACCESS(this_ptr_ptr);
42958 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
42959 FREE((void*)this_ptr);
42960 NetworkUpdate_free(this_ptr_conv);
42963 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
42964 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42965 *ret_copy = NetworkUpdate_clone(arg);
42966 int64_t ret_ref = (uintptr_t)ret_copy;
42969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42970 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
42971 int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
42975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42976 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
42977 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42978 *ret_copy = NetworkUpdate_clone(orig_conv);
42979 int64_t ret_ref = (uintptr_t)ret_copy;
42983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
42984 LDKChannelUpdate msg_conv;
42985 msg_conv.inner = (void*)(msg & (~1));
42986 msg_conv.is_owned = (msg & 1) || (msg == 0);
42987 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42988 msg_conv = ChannelUpdate_clone(&msg_conv);
42989 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42990 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
42991 int64_t ret_ref = (uintptr_t)ret_copy;
42995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
42996 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
42997 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
42998 int64_t ret_ref = (uintptr_t)ret_copy;
43002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
43003 LDKPublicKey node_id_ref;
43004 CHECK((*env)->GetArrayLength(env, node_id) == 33);
43005 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
43006 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43007 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
43008 int64_t ret_ref = (uintptr_t)ret_copy;
43012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
43013 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
43014 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
43015 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43016 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43017 CVec_u8Z_free(ret_var);
43021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43022 LDKu8slice ser_ref;
43023 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43024 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43025 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
43026 *ret_conv = NetworkUpdate_read(ser_ref);
43027 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43028 return (int64_t)ret_conv;
43031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43032 LDKP2PGossipSync this_obj_conv;
43033 this_obj_conv.inner = (void*)(this_obj & (~1));
43034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43036 P2PGossipSync_free(this_obj_conv);
43039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
43040 LDKNetworkGraph network_graph_conv;
43041 network_graph_conv.inner = (void*)(network_graph & (~1));
43042 network_graph_conv.is_owned = false;
43043 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43044 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43045 CHECK_ACCESS(chain_access_ptr);
43046 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43047 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43048 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43049 // Manually implement clone for Java trait instances
43050 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43051 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43052 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43055 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43056 CHECK_ACCESS(logger_ptr);
43057 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43058 if (logger_conv.free == LDKLogger_JCalls_free) {
43059 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43060 LDKLogger_JCalls_cloned(&logger_conv);
43062 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
43063 int64_t ret_ref = 0;
43064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43067 ret_ref = (uintptr_t)ret_var.inner;
43068 if (ret_var.is_owned) {
43074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
43075 LDKP2PGossipSync this_arg_conv;
43076 this_arg_conv.inner = (void*)(this_arg & (~1));
43077 this_arg_conv.is_owned = false;
43078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43079 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
43080 CHECK_ACCESS(chain_access_ptr);
43081 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43082 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43083 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43084 // Manually implement clone for Java trait instances
43085 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43086 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43087 LDKAccess_JCalls_cloned(&chain_access_conv.some);
43090 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
43093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
43094 LDKNetworkGraph this_arg_conv;
43095 this_arg_conv.inner = (void*)(this_arg & (~1));
43096 this_arg_conv.is_owned = false;
43097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43098 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
43099 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
43100 return (int64_t)ret_ret;
43103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
43104 LDKP2PGossipSync this_arg_conv;
43105 this_arg_conv.inner = (void*)(this_arg & (~1));
43106 this_arg_conv.is_owned = false;
43107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43108 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
43109 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
43110 return (int64_t)ret_ret;
43113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
43114 LDKP2PGossipSync this_arg_conv;
43115 this_arg_conv.inner = (void*)(this_arg & (~1));
43116 this_arg_conv.is_owned = false;
43117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43118 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43119 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
43120 return (int64_t)ret_ret;
43123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43124 LDKChannelUpdateInfo this_obj_conv;
43125 this_obj_conv.inner = (void*)(this_obj & (~1));
43126 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43128 ChannelUpdateInfo_free(this_obj_conv);
43131 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
43132 LDKChannelUpdateInfo this_ptr_conv;
43133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43134 this_ptr_conv.is_owned = false;
43135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43136 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
43140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43141 LDKChannelUpdateInfo this_ptr_conv;
43142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43143 this_ptr_conv.is_owned = false;
43144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43145 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
43148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
43149 LDKChannelUpdateInfo this_ptr_conv;
43150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43151 this_ptr_conv.is_owned = false;
43152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43153 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
43157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43158 LDKChannelUpdateInfo this_ptr_conv;
43159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43160 this_ptr_conv.is_owned = false;
43161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43162 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
43165 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43166 LDKChannelUpdateInfo this_ptr_conv;
43167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43168 this_ptr_conv.is_owned = false;
43169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43170 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
43174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43175 LDKChannelUpdateInfo this_ptr_conv;
43176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43177 this_ptr_conv.is_owned = false;
43178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43179 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
43182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43183 LDKChannelUpdateInfo this_ptr_conv;
43184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43185 this_ptr_conv.is_owned = false;
43186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43187 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
43191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43192 LDKChannelUpdateInfo this_ptr_conv;
43193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43194 this_ptr_conv.is_owned = false;
43195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43196 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
43199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43200 LDKChannelUpdateInfo this_ptr_conv;
43201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43202 this_ptr_conv.is_owned = false;
43203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43204 int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
43208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43209 LDKChannelUpdateInfo this_ptr_conv;
43210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43211 this_ptr_conv.is_owned = false;
43212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43213 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
43217 LDKChannelUpdateInfo this_ptr_conv;
43218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43219 this_ptr_conv.is_owned = false;
43220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43221 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
43222 int64_t ret_ref = 0;
43223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43226 ret_ref = (uintptr_t)ret_var.inner;
43227 if (ret_var.is_owned) {
43233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43234 LDKChannelUpdateInfo this_ptr_conv;
43235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43236 this_ptr_conv.is_owned = false;
43237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43238 LDKRoutingFees val_conv;
43239 val_conv.inner = (void*)(val & (~1));
43240 val_conv.is_owned = (val & 1) || (val == 0);
43241 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43242 val_conv = RoutingFees_clone(&val_conv);
43243 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
43246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
43247 LDKChannelUpdateInfo this_ptr_conv;
43248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43249 this_ptr_conv.is_owned = false;
43250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43251 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
43252 int64_t ret_ref = 0;
43253 if ((uintptr_t)ret_var.inner > 4096) {
43254 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43255 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43257 ret_ref = (uintptr_t)ret_var.inner;
43258 if (ret_var.is_owned) {
43265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43266 LDKChannelUpdateInfo this_ptr_conv;
43267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43268 this_ptr_conv.is_owned = false;
43269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43270 LDKChannelUpdate val_conv;
43271 val_conv.inner = (void*)(val & (~1));
43272 val_conv.is_owned = (val & 1) || (val == 0);
43273 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43274 val_conv = ChannelUpdate_clone(&val_conv);
43275 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
43278 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) {
43279 LDKRoutingFees fees_arg_conv;
43280 fees_arg_conv.inner = (void*)(fees_arg & (~1));
43281 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
43282 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
43283 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
43284 LDKChannelUpdate last_update_message_arg_conv;
43285 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
43286 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
43287 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
43288 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
43289 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv);
43290 int64_t ret_ref = 0;
43291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43294 ret_ref = (uintptr_t)ret_var.inner;
43295 if (ret_var.is_owned) {
43301 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
43302 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
43303 int64_t ret_ref = 0;
43304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43307 ret_ref = (uintptr_t)ret_var.inner;
43308 if (ret_var.is_owned) {
43313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43314 LDKChannelUpdateInfo arg_conv;
43315 arg_conv.inner = (void*)(arg & (~1));
43316 arg_conv.is_owned = false;
43317 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43318 int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
43322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43323 LDKChannelUpdateInfo orig_conv;
43324 orig_conv.inner = (void*)(orig & (~1));
43325 orig_conv.is_owned = false;
43326 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43327 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
43328 int64_t ret_ref = 0;
43329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43332 ret_ref = (uintptr_t)ret_var.inner;
43333 if (ret_var.is_owned) {
43339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43340 LDKChannelUpdateInfo obj_conv;
43341 obj_conv.inner = (void*)(obj & (~1));
43342 obj_conv.is_owned = false;
43343 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43344 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
43345 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43346 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43347 CVec_u8Z_free(ret_var);
43351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43352 LDKu8slice ser_ref;
43353 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43354 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43355 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
43356 *ret_conv = ChannelUpdateInfo_read(ser_ref);
43357 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43358 return (int64_t)ret_conv;
43361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43362 LDKChannelInfo this_obj_conv;
43363 this_obj_conv.inner = (void*)(this_obj & (~1));
43364 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43366 ChannelInfo_free(this_obj_conv);
43369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43370 LDKChannelInfo this_ptr_conv;
43371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43372 this_ptr_conv.is_owned = false;
43373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43374 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
43375 int64_t ret_ref = 0;
43376 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43377 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43378 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43379 ret_ref = (uintptr_t)ret_var.inner;
43380 if (ret_var.is_owned) {
43386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43387 LDKChannelInfo this_ptr_conv;
43388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43389 this_ptr_conv.is_owned = false;
43390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43391 LDKChannelFeatures val_conv;
43392 val_conv.inner = (void*)(val & (~1));
43393 val_conv.is_owned = (val & 1) || (val == 0);
43394 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43395 val_conv = ChannelFeatures_clone(&val_conv);
43396 ChannelInfo_set_features(&this_ptr_conv, val_conv);
43399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
43400 LDKChannelInfo this_ptr_conv;
43401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43402 this_ptr_conv.is_owned = false;
43403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43404 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
43405 int64_t ret_ref = 0;
43406 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43407 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43409 ret_ref = (uintptr_t)ret_var.inner;
43410 if (ret_var.is_owned) {
43416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43417 LDKChannelInfo this_ptr_conv;
43418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43419 this_ptr_conv.is_owned = false;
43420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43421 LDKNodeId val_conv;
43422 val_conv.inner = (void*)(val & (~1));
43423 val_conv.is_owned = (val & 1) || (val == 0);
43424 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43425 val_conv = NodeId_clone(&val_conv);
43426 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
43429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
43430 LDKChannelInfo this_ptr_conv;
43431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43432 this_ptr_conv.is_owned = false;
43433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43434 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
43435 int64_t ret_ref = 0;
43436 if ((uintptr_t)ret_var.inner > 4096) {
43437 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43438 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43440 ret_ref = (uintptr_t)ret_var.inner;
43441 if (ret_var.is_owned) {
43448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43449 LDKChannelInfo this_ptr_conv;
43450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43451 this_ptr_conv.is_owned = false;
43452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43453 LDKChannelUpdateInfo val_conv;
43454 val_conv.inner = (void*)(val & (~1));
43455 val_conv.is_owned = (val & 1) || (val == 0);
43456 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43457 val_conv = ChannelUpdateInfo_clone(&val_conv);
43458 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
43461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
43462 LDKChannelInfo this_ptr_conv;
43463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43464 this_ptr_conv.is_owned = false;
43465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43466 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
43467 int64_t ret_ref = 0;
43468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43471 ret_ref = (uintptr_t)ret_var.inner;
43472 if (ret_var.is_owned) {
43478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43479 LDKChannelInfo this_ptr_conv;
43480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43481 this_ptr_conv.is_owned = false;
43482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43483 LDKNodeId val_conv;
43484 val_conv.inner = (void*)(val & (~1));
43485 val_conv.is_owned = (val & 1) || (val == 0);
43486 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43487 val_conv = NodeId_clone(&val_conv);
43488 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
43491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
43492 LDKChannelInfo this_ptr_conv;
43493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43494 this_ptr_conv.is_owned = false;
43495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43496 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
43497 int64_t ret_ref = 0;
43498 if ((uintptr_t)ret_var.inner > 4096) {
43499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43502 ret_ref = (uintptr_t)ret_var.inner;
43503 if (ret_var.is_owned) {
43510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43511 LDKChannelInfo this_ptr_conv;
43512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43513 this_ptr_conv.is_owned = false;
43514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43515 LDKChannelUpdateInfo val_conv;
43516 val_conv.inner = (void*)(val & (~1));
43517 val_conv.is_owned = (val & 1) || (val == 0);
43518 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43519 val_conv = ChannelUpdateInfo_clone(&val_conv);
43520 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
43523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
43524 LDKChannelInfo this_ptr_conv;
43525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43526 this_ptr_conv.is_owned = false;
43527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43528 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43529 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
43530 int64_t ret_ref = (uintptr_t)ret_copy;
43534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43535 LDKChannelInfo this_ptr_conv;
43536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43537 this_ptr_conv.is_owned = false;
43538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43539 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
43540 CHECK_ACCESS(val_ptr);
43541 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43542 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
43543 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
43546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
43547 LDKChannelInfo this_ptr_conv;
43548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43549 this_ptr_conv.is_owned = false;
43550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43551 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
43552 int64_t ret_ref = 0;
43553 if ((uintptr_t)ret_var.inner > 4096) {
43554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43557 ret_ref = (uintptr_t)ret_var.inner;
43558 if (ret_var.is_owned) {
43565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43566 LDKChannelInfo this_ptr_conv;
43567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43568 this_ptr_conv.is_owned = false;
43569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43570 LDKChannelAnnouncement val_conv;
43571 val_conv.inner = (void*)(val & (~1));
43572 val_conv.is_owned = (val & 1) || (val == 0);
43573 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43574 val_conv = ChannelAnnouncement_clone(&val_conv);
43575 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
43578 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
43579 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
43580 int64_t ret_ref = 0;
43581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43584 ret_ref = (uintptr_t)ret_var.inner;
43585 if (ret_var.is_owned) {
43590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43591 LDKChannelInfo arg_conv;
43592 arg_conv.inner = (void*)(arg & (~1));
43593 arg_conv.is_owned = false;
43594 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43595 int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
43599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43600 LDKChannelInfo orig_conv;
43601 orig_conv.inner = (void*)(orig & (~1));
43602 orig_conv.is_owned = false;
43603 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43604 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
43605 int64_t ret_ref = 0;
43606 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43607 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43609 ret_ref = (uintptr_t)ret_var.inner;
43610 if (ret_var.is_owned) {
43616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1directional_1info(JNIEnv *env, jclass clz, int64_t this_arg, int8_t channel_flags) {
43617 LDKChannelInfo this_arg_conv;
43618 this_arg_conv.inner = (void*)(this_arg & (~1));
43619 this_arg_conv.is_owned = false;
43620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43621 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
43622 int64_t ret_ref = 0;
43623 if ((uintptr_t)ret_var.inner > 4096) {
43624 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43625 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43626 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43627 ret_ref = (uintptr_t)ret_var.inner;
43628 if (ret_var.is_owned) {
43635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43636 LDKChannelInfo obj_conv;
43637 obj_conv.inner = (void*)(obj & (~1));
43638 obj_conv.is_owned = false;
43639 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43640 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
43641 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43642 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43643 CVec_u8Z_free(ret_var);
43647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43648 LDKu8slice ser_ref;
43649 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43650 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43651 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
43652 *ret_conv = ChannelInfo_read(ser_ref);
43653 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43654 return (int64_t)ret_conv;
43657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43658 LDKDirectedChannelInfo this_obj_conv;
43659 this_obj_conv.inner = (void*)(this_obj & (~1));
43660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43662 DirectedChannelInfo_free(this_obj_conv);
43665 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
43666 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
43667 int64_t ret_ref = 0;
43668 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43669 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43671 ret_ref = (uintptr_t)ret_var.inner;
43672 if (ret_var.is_owned) {
43677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43678 LDKDirectedChannelInfo arg_conv;
43679 arg_conv.inner = (void*)(arg & (~1));
43680 arg_conv.is_owned = false;
43681 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43682 int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
43686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43687 LDKDirectedChannelInfo orig_conv;
43688 orig_conv.inner = (void*)(orig & (~1));
43689 orig_conv.is_owned = false;
43690 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43691 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
43692 int64_t ret_ref = 0;
43693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43696 ret_ref = (uintptr_t)ret_var.inner;
43697 if (ret_var.is_owned) {
43703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
43704 LDKDirectedChannelInfo this_arg_conv;
43705 this_arg_conv.inner = (void*)(this_arg & (~1));
43706 this_arg_conv.is_owned = false;
43707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43708 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
43709 int64_t ret_ref = 0;
43710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43713 ret_ref = (uintptr_t)ret_var.inner;
43714 if (ret_var.is_owned) {
43720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
43721 LDKDirectedChannelInfo this_arg_conv;
43722 this_arg_conv.inner = (void*)(this_arg & (~1));
43723 this_arg_conv.is_owned = false;
43724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43725 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
43726 int64_t ret_ref = 0;
43727 if ((uintptr_t)ret_var.inner > 4096) {
43728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43731 ret_ref = (uintptr_t)ret_var.inner;
43732 if (ret_var.is_owned) {
43739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
43740 LDKDirectedChannelInfo this_arg_conv;
43741 this_arg_conv.inner = (void*)(this_arg & (~1));
43742 this_arg_conv.is_owned = false;
43743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43744 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
43748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
43749 LDKDirectedChannelInfo this_arg_conv;
43750 this_arg_conv.inner = (void*)(this_arg & (~1));
43751 this_arg_conv.is_owned = false;
43752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43753 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43754 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
43755 int64_t ret_ref = (uintptr_t)ret_copy;
43759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43760 if ((this_ptr & 1) != 0) return;
43761 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43762 CHECK_ACCESS(this_ptr_ptr);
43763 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
43764 FREE((void*)this_ptr);
43765 EffectiveCapacity_free(this_ptr_conv);
43768 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
43769 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43770 *ret_copy = EffectiveCapacity_clone(arg);
43771 int64_t ret_ref = (uintptr_t)ret_copy;
43774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43775 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
43776 int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
43780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43781 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
43782 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43783 *ret_copy = EffectiveCapacity_clone(orig_conv);
43784 int64_t ret_ref = (uintptr_t)ret_copy;
43788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
43789 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43790 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
43791 int64_t ret_ref = (uintptr_t)ret_copy;
43795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
43796 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43797 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
43798 int64_t ret_ref = (uintptr_t)ret_copy;
43802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
43803 void* htlc_maximum_msat_ptr = (void*)(((uintptr_t)htlc_maximum_msat) & ~1);
43804 CHECK_ACCESS(htlc_maximum_msat_ptr);
43805 LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
43806 htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat) & ~1));
43807 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43808 *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
43809 int64_t ret_ref = (uintptr_t)ret_copy;
43813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
43814 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43815 *ret_copy = EffectiveCapacity_infinite();
43816 int64_t ret_ref = (uintptr_t)ret_copy;
43820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
43821 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43822 *ret_copy = EffectiveCapacity_unknown();
43823 int64_t ret_ref = (uintptr_t)ret_copy;
43827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
43828 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
43829 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
43833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43834 LDKRoutingFees this_obj_conv;
43835 this_obj_conv.inner = (void*)(this_obj & (~1));
43836 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43838 RoutingFees_free(this_obj_conv);
43841 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43842 LDKRoutingFees this_ptr_conv;
43843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43844 this_ptr_conv.is_owned = false;
43845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43846 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
43850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43851 LDKRoutingFees this_ptr_conv;
43852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43853 this_ptr_conv.is_owned = false;
43854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43855 RoutingFees_set_base_msat(&this_ptr_conv, val);
43858 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43859 LDKRoutingFees this_ptr_conv;
43860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43861 this_ptr_conv.is_owned = false;
43862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43863 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
43867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43868 LDKRoutingFees this_ptr_conv;
43869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43870 this_ptr_conv.is_owned = false;
43871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43872 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
43875 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) {
43876 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
43877 int64_t ret_ref = 0;
43878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43881 ret_ref = (uintptr_t)ret_var.inner;
43882 if (ret_var.is_owned) {
43888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43889 LDKRoutingFees a_conv;
43890 a_conv.inner = (void*)(a & (~1));
43891 a_conv.is_owned = false;
43892 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43893 LDKRoutingFees b_conv;
43894 b_conv.inner = (void*)(b & (~1));
43895 b_conv.is_owned = false;
43896 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43897 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
43901 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
43902 LDKRoutingFees ret_var = RoutingFees_clone(arg);
43903 int64_t ret_ref = 0;
43904 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43905 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43907 ret_ref = (uintptr_t)ret_var.inner;
43908 if (ret_var.is_owned) {
43913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43914 LDKRoutingFees arg_conv;
43915 arg_conv.inner = (void*)(arg & (~1));
43916 arg_conv.is_owned = false;
43917 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43918 int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
43922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43923 LDKRoutingFees orig_conv;
43924 orig_conv.inner = (void*)(orig & (~1));
43925 orig_conv.is_owned = false;
43926 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43927 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
43928 int64_t ret_ref = 0;
43929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43932 ret_ref = (uintptr_t)ret_var.inner;
43933 if (ret_var.is_owned) {
43939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
43940 LDKRoutingFees o_conv;
43941 o_conv.inner = (void*)(o & (~1));
43942 o_conv.is_owned = false;
43943 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43944 int64_t ret_conv = RoutingFees_hash(&o_conv);
43948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
43949 LDKRoutingFees obj_conv;
43950 obj_conv.inner = (void*)(obj & (~1));
43951 obj_conv.is_owned = false;
43952 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43953 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
43954 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43955 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43956 CVec_u8Z_free(ret_var);
43960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43961 LDKu8slice ser_ref;
43962 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43963 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43964 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
43965 *ret_conv = RoutingFees_read(ser_ref);
43966 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43967 return (int64_t)ret_conv;
43970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43971 LDKNodeAnnouncementInfo this_obj_conv;
43972 this_obj_conv.inner = (void*)(this_obj & (~1));
43973 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43975 NodeAnnouncementInfo_free(this_obj_conv);
43978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43979 LDKNodeAnnouncementInfo this_ptr_conv;
43980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43981 this_ptr_conv.is_owned = false;
43982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43983 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
43984 int64_t ret_ref = 0;
43985 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43986 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43988 ret_ref = (uintptr_t)ret_var.inner;
43989 if (ret_var.is_owned) {
43995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43996 LDKNodeAnnouncementInfo this_ptr_conv;
43997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43998 this_ptr_conv.is_owned = false;
43999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44000 LDKNodeFeatures val_conv;
44001 val_conv.inner = (void*)(val & (~1));
44002 val_conv.is_owned = (val & 1) || (val == 0);
44003 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44004 val_conv = NodeFeatures_clone(&val_conv);
44005 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
44008 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
44009 LDKNodeAnnouncementInfo this_ptr_conv;
44010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44011 this_ptr_conv.is_owned = false;
44012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44013 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
44017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44018 LDKNodeAnnouncementInfo this_ptr_conv;
44019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44020 this_ptr_conv.is_owned = false;
44021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44022 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
44025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
44026 LDKNodeAnnouncementInfo this_ptr_conv;
44027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44028 this_ptr_conv.is_owned = false;
44029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44030 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
44031 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
44035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44036 LDKNodeAnnouncementInfo this_ptr_conv;
44037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44038 this_ptr_conv.is_owned = false;
44039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44040 LDKThreeBytes val_ref;
44041 CHECK((*env)->GetArrayLength(env, val) == 3);
44042 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
44043 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
44046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
44047 LDKNodeAnnouncementInfo this_ptr_conv;
44048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44049 this_ptr_conv.is_owned = false;
44050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44051 LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
44052 int64_t ret_ref = 0;
44053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44056 ret_ref = (uintptr_t)ret_var.inner;
44057 if (ret_var.is_owned) {
44063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44064 LDKNodeAnnouncementInfo this_ptr_conv;
44065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44066 this_ptr_conv.is_owned = false;
44067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44068 LDKNodeAlias val_conv;
44069 val_conv.inner = (void*)(val & (~1));
44070 val_conv.is_owned = (val & 1) || (val == 0);
44071 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44072 val_conv = NodeAlias_clone(&val_conv);
44073 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
44076 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
44077 LDKNodeAnnouncementInfo this_ptr_conv;
44078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44079 this_ptr_conv.is_owned = false;
44080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44081 LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
44082 int64_tArray ret_arr = NULL;
44083 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44084 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44085 for (size_t m = 0; m < ret_var.datalen; m++) {
44086 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
44087 *ret_conv_12_copy = ret_var.data[m];
44088 int64_t ret_conv_12_ref = (uintptr_t)ret_conv_12_copy;
44089 ret_arr_ptr[m] = ret_conv_12_ref;
44091 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44092 FREE(ret_var.data);
44096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44097 LDKNodeAnnouncementInfo this_ptr_conv;
44098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44099 this_ptr_conv.is_owned = false;
44100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44101 LDKCVec_NetAddressZ val_constr;
44102 val_constr.datalen = (*env)->GetArrayLength(env, val);
44103 if (val_constr.datalen > 0)
44104 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44106 val_constr.data = NULL;
44107 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44108 for (size_t m = 0; m < val_constr.datalen; m++) {
44109 int64_t val_conv_12 = val_vals[m];
44110 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
44111 CHECK_ACCESS(val_conv_12_ptr);
44112 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
44113 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
44114 val_constr.data[m] = val_conv_12_conv;
44116 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44117 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
44120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
44121 LDKNodeAnnouncementInfo this_ptr_conv;
44122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44123 this_ptr_conv.is_owned = false;
44124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44125 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
44126 int64_t ret_ref = 0;
44127 if ((uintptr_t)ret_var.inner > 4096) {
44128 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44129 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44131 ret_ref = (uintptr_t)ret_var.inner;
44132 if (ret_var.is_owned) {
44139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44140 LDKNodeAnnouncementInfo this_ptr_conv;
44141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44142 this_ptr_conv.is_owned = false;
44143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44144 LDKNodeAnnouncement val_conv;
44145 val_conv.inner = (void*)(val & (~1));
44146 val_conv.is_owned = (val & 1) || (val == 0);
44147 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44148 val_conv = NodeAnnouncement_clone(&val_conv);
44149 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
44152 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, int64_t alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
44153 LDKNodeFeatures features_arg_conv;
44154 features_arg_conv.inner = (void*)(features_arg & (~1));
44155 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
44156 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44157 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
44158 LDKThreeBytes rgb_arg_ref;
44159 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
44160 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
44161 LDKNodeAlias alias_arg_conv;
44162 alias_arg_conv.inner = (void*)(alias_arg & (~1));
44163 alias_arg_conv.is_owned = (alias_arg & 1) || (alias_arg == 0);
44164 CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
44165 alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
44166 LDKCVec_NetAddressZ addresses_arg_constr;
44167 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
44168 if (addresses_arg_constr.datalen > 0)
44169 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44171 addresses_arg_constr.data = NULL;
44172 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
44173 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
44174 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
44175 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
44176 CHECK_ACCESS(addresses_arg_conv_12_ptr);
44177 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
44178 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
44180 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
44181 LDKNodeAnnouncement announcement_message_arg_conv;
44182 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
44183 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
44184 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
44185 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
44186 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
44187 int64_t ret_ref = 0;
44188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44191 ret_ref = (uintptr_t)ret_var.inner;
44192 if (ret_var.is_owned) {
44198 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
44199 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
44200 int64_t ret_ref = 0;
44201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44204 ret_ref = (uintptr_t)ret_var.inner;
44205 if (ret_var.is_owned) {
44210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44211 LDKNodeAnnouncementInfo arg_conv;
44212 arg_conv.inner = (void*)(arg & (~1));
44213 arg_conv.is_owned = false;
44214 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44215 int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
44219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44220 LDKNodeAnnouncementInfo orig_conv;
44221 orig_conv.inner = (void*)(orig & (~1));
44222 orig_conv.is_owned = false;
44223 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44224 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
44225 int64_t ret_ref = 0;
44226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44229 ret_ref = (uintptr_t)ret_var.inner;
44230 if (ret_var.is_owned) {
44236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44237 LDKNodeAnnouncementInfo obj_conv;
44238 obj_conv.inner = (void*)(obj & (~1));
44239 obj_conv.is_owned = false;
44240 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44241 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
44242 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44243 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44244 CVec_u8Z_free(ret_var);
44248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44249 LDKu8slice ser_ref;
44250 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44251 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44252 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
44253 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
44254 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44255 return (int64_t)ret_conv;
44258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44259 LDKNodeAlias this_obj_conv;
44260 this_obj_conv.inner = (void*)(this_obj & (~1));
44261 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44263 NodeAlias_free(this_obj_conv);
44266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44267 LDKNodeAlias this_ptr_conv;
44268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44269 this_ptr_conv.is_owned = false;
44270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44271 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44272 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
44276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44277 LDKNodeAlias this_ptr_conv;
44278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44279 this_ptr_conv.is_owned = false;
44280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44281 LDKThirtyTwoBytes val_ref;
44282 CHECK((*env)->GetArrayLength(env, val) == 32);
44283 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44284 NodeAlias_set_a(&this_ptr_conv, val_ref);
44287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
44288 LDKThirtyTwoBytes a_arg_ref;
44289 CHECK((*env)->GetArrayLength(env, a_arg) == 32);
44290 (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
44291 LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
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 static inline uintptr_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
44304 LDKNodeAlias ret_var = NodeAlias_clone(arg);
44305 int64_t ret_ref = 0;
44306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44309 ret_ref = (uintptr_t)ret_var.inner;
44310 if (ret_var.is_owned) {
44315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44316 LDKNodeAlias arg_conv;
44317 arg_conv.inner = (void*)(arg & (~1));
44318 arg_conv.is_owned = false;
44319 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44320 int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
44324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44325 LDKNodeAlias orig_conv;
44326 orig_conv.inner = (void*)(orig & (~1));
44327 orig_conv.is_owned = false;
44328 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44329 LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
44330 int64_t ret_ref = 0;
44331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44334 ret_ref = (uintptr_t)ret_var.inner;
44335 if (ret_var.is_owned) {
44341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
44342 LDKNodeAlias obj_conv;
44343 obj_conv.inner = (void*)(obj & (~1));
44344 obj_conv.is_owned = false;
44345 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44346 LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
44347 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44348 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44349 CVec_u8Z_free(ret_var);
44353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44354 LDKu8slice ser_ref;
44355 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44356 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44357 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
44358 *ret_conv = NodeAlias_read(ser_ref);
44359 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44360 return (int64_t)ret_conv;
44363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44364 LDKNodeInfo this_obj_conv;
44365 this_obj_conv.inner = (void*)(this_obj & (~1));
44366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44368 NodeInfo_free(this_obj_conv);
44371 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44372 LDKNodeInfo this_ptr_conv;
44373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44374 this_ptr_conv.is_owned = false;
44375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44376 LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
44377 int64_tArray ret_arr = NULL;
44378 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44379 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44380 for (size_t g = 0; g < ret_var.datalen; g++) {
44381 int64_t ret_conv_6_conv = ret_var.data[g];
44382 ret_arr_ptr[g] = ret_conv_6_conv;
44384 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44385 FREE(ret_var.data);
44389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44390 LDKNodeInfo this_ptr_conv;
44391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44392 this_ptr_conv.is_owned = false;
44393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44394 LDKCVec_u64Z val_constr;
44395 val_constr.datalen = (*env)->GetArrayLength(env, val);
44396 if (val_constr.datalen > 0)
44397 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44399 val_constr.data = NULL;
44400 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44401 for (size_t g = 0; g < val_constr.datalen; g++) {
44402 int64_t val_conv_6 = val_vals[g];
44403 val_constr.data[g] = val_conv_6;
44405 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44406 NodeInfo_set_channels(&this_ptr_conv, val_constr);
44409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
44410 LDKNodeInfo this_ptr_conv;
44411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44412 this_ptr_conv.is_owned = false;
44413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44414 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
44415 int64_t ret_ref = 0;
44416 if ((uintptr_t)ret_var.inner > 4096) {
44417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44420 ret_ref = (uintptr_t)ret_var.inner;
44421 if (ret_var.is_owned) {
44428 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) {
44429 LDKNodeInfo this_ptr_conv;
44430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44431 this_ptr_conv.is_owned = false;
44432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44433 LDKRoutingFees val_conv;
44434 val_conv.inner = (void*)(val & (~1));
44435 val_conv.is_owned = (val & 1) || (val == 0);
44436 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44437 val_conv = RoutingFees_clone(&val_conv);
44438 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
44441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
44442 LDKNodeInfo this_ptr_conv;
44443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44444 this_ptr_conv.is_owned = false;
44445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44446 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
44447 int64_t ret_ref = 0;
44448 if ((uintptr_t)ret_var.inner > 4096) {
44449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44452 ret_ref = (uintptr_t)ret_var.inner;
44453 if (ret_var.is_owned) {
44460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44461 LDKNodeInfo this_ptr_conv;
44462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44463 this_ptr_conv.is_owned = false;
44464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44465 LDKNodeAnnouncementInfo val_conv;
44466 val_conv.inner = (void*)(val & (~1));
44467 val_conv.is_owned = (val & 1) || (val == 0);
44468 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44469 val_conv = NodeAnnouncementInfo_clone(&val_conv);
44470 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
44473 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) {
44474 LDKCVec_u64Z channels_arg_constr;
44475 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
44476 if (channels_arg_constr.datalen > 0)
44477 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44479 channels_arg_constr.data = NULL;
44480 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
44481 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
44482 int64_t channels_arg_conv_6 = channels_arg_vals[g];
44483 channels_arg_constr.data[g] = channels_arg_conv_6;
44485 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
44486 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
44487 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
44488 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
44489 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
44490 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
44491 LDKNodeAnnouncementInfo announcement_info_arg_conv;
44492 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
44493 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
44494 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
44495 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
44496 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
44497 int64_t ret_ref = 0;
44498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44501 ret_ref = (uintptr_t)ret_var.inner;
44502 if (ret_var.is_owned) {
44508 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
44509 LDKNodeInfo ret_var = NodeInfo_clone(arg);
44510 int64_t ret_ref = 0;
44511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44514 ret_ref = (uintptr_t)ret_var.inner;
44515 if (ret_var.is_owned) {
44520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44521 LDKNodeInfo arg_conv;
44522 arg_conv.inner = (void*)(arg & (~1));
44523 arg_conv.is_owned = false;
44524 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44525 int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
44529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44530 LDKNodeInfo orig_conv;
44531 orig_conv.inner = (void*)(orig & (~1));
44532 orig_conv.is_owned = false;
44533 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44534 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
44535 int64_t ret_ref = 0;
44536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44539 ret_ref = (uintptr_t)ret_var.inner;
44540 if (ret_var.is_owned) {
44546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44547 LDKNodeInfo obj_conv;
44548 obj_conv.inner = (void*)(obj & (~1));
44549 obj_conv.is_owned = false;
44550 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44551 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
44552 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44553 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44554 CVec_u8Z_free(ret_var);
44558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44559 LDKu8slice ser_ref;
44560 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44561 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44562 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
44563 *ret_conv = NodeInfo_read(ser_ref);
44564 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44565 return (int64_t)ret_conv;
44568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
44569 LDKNetworkGraph obj_conv;
44570 obj_conv.inner = (void*)(obj & (~1));
44571 obj_conv.is_owned = false;
44572 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44573 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
44574 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44575 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44576 CVec_u8Z_free(ret_var);
44580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
44581 LDKu8slice ser_ref;
44582 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44583 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44584 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
44585 CHECK_ACCESS(arg_ptr);
44586 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
44587 if (arg_conv.free == LDKLogger_JCalls_free) {
44588 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44589 LDKLogger_JCalls_cloned(&arg_conv);
44591 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
44592 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
44593 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44594 return (int64_t)ret_conv;
44597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
44598 LDKThirtyTwoBytes genesis_hash_ref;
44599 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
44600 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
44601 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44602 CHECK_ACCESS(logger_ptr);
44603 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44604 if (logger_conv.free == LDKLogger_JCalls_free) {
44605 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44606 LDKLogger_JCalls_cloned(&logger_conv);
44608 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
44609 int64_t ret_ref = 0;
44610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44613 ret_ref = (uintptr_t)ret_var.inner;
44614 if (ret_var.is_owned) {
44620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
44621 LDKNetworkGraph this_arg_conv;
44622 this_arg_conv.inner = (void*)(this_arg & (~1));
44623 this_arg_conv.is_owned = false;
44624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44625 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
44626 int64_t ret_ref = 0;
44627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44630 ret_ref = (uintptr_t)ret_var.inner;
44631 if (ret_var.is_owned) {
44637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
44638 LDKNetworkGraph this_arg_conv;
44639 this_arg_conv.inner = (void*)(this_arg & (~1));
44640 this_arg_conv.is_owned = false;
44641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44642 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
44643 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
44644 int64_t ret_ref = (uintptr_t)ret_copy;
44648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1set_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
44649 LDKNetworkGraph this_arg_conv;
44650 this_arg_conv.inner = (void*)(this_arg & (~1));
44651 this_arg_conv.is_owned = false;
44652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44653 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
44656 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) {
44657 LDKNetworkGraph this_arg_conv;
44658 this_arg_conv.inner = (void*)(this_arg & (~1));
44659 this_arg_conv.is_owned = false;
44660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44661 LDKNodeAnnouncement msg_conv;
44662 msg_conv.inner = (void*)(msg & (~1));
44663 msg_conv.is_owned = false;
44664 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44665 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44666 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
44667 return (int64_t)ret_conv;
44670 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) {
44671 LDKNetworkGraph this_arg_conv;
44672 this_arg_conv.inner = (void*)(this_arg & (~1));
44673 this_arg_conv.is_owned = false;
44674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44675 LDKUnsignedNodeAnnouncement msg_conv;
44676 msg_conv.inner = (void*)(msg & (~1));
44677 msg_conv.is_owned = false;
44678 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44679 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44680 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
44681 return (int64_t)ret_conv;
44684 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) {
44685 LDKNetworkGraph this_arg_conv;
44686 this_arg_conv.inner = (void*)(this_arg & (~1));
44687 this_arg_conv.is_owned = false;
44688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44689 LDKChannelAnnouncement msg_conv;
44690 msg_conv.inner = (void*)(msg & (~1));
44691 msg_conv.is_owned = false;
44692 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44693 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
44694 CHECK_ACCESS(chain_access_ptr);
44695 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
44696 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
44697 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
44698 // Manually implement clone for Java trait instances
44699 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
44700 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44701 LDKAccess_JCalls_cloned(&chain_access_conv.some);
44704 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44705 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
44706 return (int64_t)ret_conv;
44709 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) {
44710 LDKNetworkGraph this_arg_conv;
44711 this_arg_conv.inner = (void*)(this_arg & (~1));
44712 this_arg_conv.is_owned = false;
44713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44714 LDKUnsignedChannelAnnouncement msg_conv;
44715 msg_conv.inner = (void*)(msg & (~1));
44716 msg_conv.is_owned = false;
44717 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44718 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
44719 CHECK_ACCESS(chain_access_ptr);
44720 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
44721 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
44722 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
44723 // Manually implement clone for Java trait instances
44724 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
44725 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44726 LDKAccess_JCalls_cloned(&chain_access_conv.some);
44729 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44730 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
44731 return (int64_t)ret_conv;
44734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1add_1channel_1from_1partial_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t timestamp, int64_t features, int8_tArray node_id_1, int8_tArray node_id_2) {
44735 LDKNetworkGraph this_arg_conv;
44736 this_arg_conv.inner = (void*)(this_arg & (~1));
44737 this_arg_conv.is_owned = false;
44738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44739 LDKChannelFeatures features_conv;
44740 features_conv.inner = (void*)(features & (~1));
44741 features_conv.is_owned = (features & 1) || (features == 0);
44742 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
44743 features_conv = ChannelFeatures_clone(&features_conv);
44744 LDKPublicKey node_id_1_ref;
44745 CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
44746 (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
44747 LDKPublicKey node_id_2_ref;
44748 CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
44749 (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
44750 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44751 *ret_conv = NetworkGraph_add_channel_from_partial_announcement(&this_arg_conv, short_channel_id, timestamp, features_conv, node_id_1_ref, node_id_2_ref);
44752 return (int64_t)ret_conv;
44755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1channel_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
44756 LDKNetworkGraph this_arg_conv;
44757 this_arg_conv.inner = (void*)(this_arg & (~1));
44758 this_arg_conv.is_owned = false;
44759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44760 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
44763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
44764 LDKNetworkGraph this_arg_conv;
44765 this_arg_conv.inner = (void*)(this_arg & (~1));
44766 this_arg_conv.is_owned = false;
44767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44768 LDKPublicKey _node_id_ref;
44769 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
44770 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
44771 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
44774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
44775 LDKNetworkGraph this_arg_conv;
44776 this_arg_conv.inner = (void*)(this_arg & (~1));
44777 this_arg_conv.is_owned = false;
44778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44779 NetworkGraph_remove_stale_channels(&this_arg_conv);
44782 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) {
44783 LDKNetworkGraph this_arg_conv;
44784 this_arg_conv.inner = (void*)(this_arg & (~1));
44785 this_arg_conv.is_owned = false;
44786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44787 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
44790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
44791 LDKNetworkGraph this_arg_conv;
44792 this_arg_conv.inner = (void*)(this_arg & (~1));
44793 this_arg_conv.is_owned = false;
44794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44795 LDKChannelUpdate msg_conv;
44796 msg_conv.inner = (void*)(msg & (~1));
44797 msg_conv.is_owned = false;
44798 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44799 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44800 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
44801 return (int64_t)ret_conv;
44804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
44805 LDKNetworkGraph this_arg_conv;
44806 this_arg_conv.inner = (void*)(this_arg & (~1));
44807 this_arg_conv.is_owned = false;
44808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44809 LDKUnsignedChannelUpdate msg_conv;
44810 msg_conv.inner = (void*)(msg & (~1));
44811 msg_conv.is_owned = false;
44812 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44813 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
44814 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
44815 return (int64_t)ret_conv;
44818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
44819 LDKReadOnlyNetworkGraph this_arg_conv;
44820 this_arg_conv.inner = (void*)(this_arg & (~1));
44821 this_arg_conv.is_owned = false;
44822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44823 LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
44824 int64_t ret_ref = 0;
44825 if ((uintptr_t)ret_var.inner > 4096) {
44826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44829 ret_ref = (uintptr_t)ret_var.inner;
44830 if (ret_var.is_owned) {
44837 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
44838 LDKReadOnlyNetworkGraph this_arg_conv;
44839 this_arg_conv.inner = (void*)(this_arg & (~1));
44840 this_arg_conv.is_owned = false;
44841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44842 LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
44843 int64_tArray ret_arr = NULL;
44844 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44845 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44846 for (size_t g = 0; g < ret_var.datalen; g++) {
44847 int64_t ret_conv_6_conv = ret_var.data[g];
44848 ret_arr_ptr[g] = ret_conv_6_conv;
44850 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44851 FREE(ret_var.data);
44855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
44856 LDKReadOnlyNetworkGraph this_arg_conv;
44857 this_arg_conv.inner = (void*)(this_arg & (~1));
44858 this_arg_conv.is_owned = false;
44859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44860 LDKNodeId node_id_conv;
44861 node_id_conv.inner = (void*)(node_id & (~1));
44862 node_id_conv.is_owned = false;
44863 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44864 LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
44865 int64_t ret_ref = 0;
44866 if ((uintptr_t)ret_var.inner > 4096) {
44867 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44868 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44870 ret_ref = (uintptr_t)ret_var.inner;
44871 if (ret_var.is_owned) {
44878 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
44879 LDKReadOnlyNetworkGraph this_arg_conv;
44880 this_arg_conv.inner = (void*)(this_arg & (~1));
44881 this_arg_conv.is_owned = false;
44882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44883 LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
44884 int64_tArray ret_arr = NULL;
44885 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44886 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44887 for (size_t i = 0; i < ret_var.datalen; i++) {
44888 LDKNodeId ret_conv_8_var = ret_var.data[i];
44889 int64_t ret_conv_8_ref = 0;
44890 CHECK((((uintptr_t)ret_conv_8_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44891 CHECK((((uintptr_t)&ret_conv_8_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
44893 ret_conv_8_ref = (uintptr_t)ret_conv_8_var.inner;
44894 if (ret_conv_8_var.is_owned) {
44895 ret_conv_8_ref |= 1;
44897 ret_arr_ptr[i] = ret_conv_8_ref;
44899 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44900 FREE(ret_var.data);
44904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
44905 LDKReadOnlyNetworkGraph this_arg_conv;
44906 this_arg_conv.inner = (void*)(this_arg & (~1));
44907 this_arg_conv.is_owned = false;
44908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44909 LDKPublicKey pubkey_ref;
44910 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
44911 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
44912 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
44913 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
44914 int64_t ret_ref = (uintptr_t)ret_copy;
44918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44919 LDKRouteHop this_obj_conv;
44920 this_obj_conv.inner = (void*)(this_obj & (~1));
44921 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44923 RouteHop_free(this_obj_conv);
44926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44927 LDKRouteHop this_ptr_conv;
44928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44929 this_ptr_conv.is_owned = false;
44930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44931 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44932 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
44936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44937 LDKRouteHop this_ptr_conv;
44938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44939 this_ptr_conv.is_owned = false;
44940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44941 LDKPublicKey val_ref;
44942 CHECK((*env)->GetArrayLength(env, val) == 33);
44943 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44944 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
44947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44948 LDKRouteHop this_ptr_conv;
44949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44950 this_ptr_conv.is_owned = false;
44951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44952 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
44953 int64_t ret_ref = 0;
44954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44957 ret_ref = (uintptr_t)ret_var.inner;
44958 if (ret_var.is_owned) {
44964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44965 LDKRouteHop this_ptr_conv;
44966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44967 this_ptr_conv.is_owned = false;
44968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44969 LDKNodeFeatures val_conv;
44970 val_conv.inner = (void*)(val & (~1));
44971 val_conv.is_owned = (val & 1) || (val == 0);
44972 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44973 val_conv = NodeFeatures_clone(&val_conv);
44974 RouteHop_set_node_features(&this_ptr_conv, val_conv);
44977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44978 LDKRouteHop this_ptr_conv;
44979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44980 this_ptr_conv.is_owned = false;
44981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44982 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
44986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44987 LDKRouteHop this_ptr_conv;
44988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44989 this_ptr_conv.is_owned = false;
44990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44991 RouteHop_set_short_channel_id(&this_ptr_conv, val);
44994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44995 LDKRouteHop this_ptr_conv;
44996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44997 this_ptr_conv.is_owned = false;
44998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44999 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
45000 int64_t ret_ref = 0;
45001 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45002 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45004 ret_ref = (uintptr_t)ret_var.inner;
45005 if (ret_var.is_owned) {
45011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45012 LDKRouteHop this_ptr_conv;
45013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45014 this_ptr_conv.is_owned = false;
45015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45016 LDKChannelFeatures val_conv;
45017 val_conv.inner = (void*)(val & (~1));
45018 val_conv.is_owned = (val & 1) || (val == 0);
45019 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45020 val_conv = ChannelFeatures_clone(&val_conv);
45021 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
45024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45025 LDKRouteHop this_ptr_conv;
45026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45027 this_ptr_conv.is_owned = false;
45028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45029 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
45033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45034 LDKRouteHop this_ptr_conv;
45035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45036 this_ptr_conv.is_owned = false;
45037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45038 RouteHop_set_fee_msat(&this_ptr_conv, val);
45041 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45042 LDKRouteHop this_ptr_conv;
45043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45044 this_ptr_conv.is_owned = false;
45045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45046 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
45050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45051 LDKRouteHop this_ptr_conv;
45052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45053 this_ptr_conv.is_owned = false;
45054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45055 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
45058 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) {
45059 LDKPublicKey pubkey_arg_ref;
45060 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
45061 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
45062 LDKNodeFeatures node_features_arg_conv;
45063 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
45064 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
45065 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
45066 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
45067 LDKChannelFeatures channel_features_arg_conv;
45068 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
45069 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
45070 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
45071 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
45072 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);
45073 int64_t ret_ref = 0;
45074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45077 ret_ref = (uintptr_t)ret_var.inner;
45078 if (ret_var.is_owned) {
45084 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
45085 LDKRouteHop ret_var = RouteHop_clone(arg);
45086 int64_t ret_ref = 0;
45087 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45088 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45090 ret_ref = (uintptr_t)ret_var.inner;
45091 if (ret_var.is_owned) {
45096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45097 LDKRouteHop arg_conv;
45098 arg_conv.inner = (void*)(arg & (~1));
45099 arg_conv.is_owned = false;
45100 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45101 int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
45105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45106 LDKRouteHop orig_conv;
45107 orig_conv.inner = (void*)(orig & (~1));
45108 orig_conv.is_owned = false;
45109 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45110 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
45111 int64_t ret_ref = 0;
45112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45115 ret_ref = (uintptr_t)ret_var.inner;
45116 if (ret_var.is_owned) {
45122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
45123 LDKRouteHop o_conv;
45124 o_conv.inner = (void*)(o & (~1));
45125 o_conv.is_owned = false;
45126 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45127 int64_t ret_conv = RouteHop_hash(&o_conv);
45131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45132 LDKRouteHop a_conv;
45133 a_conv.inner = (void*)(a & (~1));
45134 a_conv.is_owned = false;
45135 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45136 LDKRouteHop b_conv;
45137 b_conv.inner = (void*)(b & (~1));
45138 b_conv.is_owned = false;
45139 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45140 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
45144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
45145 LDKRouteHop obj_conv;
45146 obj_conv.inner = (void*)(obj & (~1));
45147 obj_conv.is_owned = false;
45148 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45149 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
45150 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45151 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45152 CVec_u8Z_free(ret_var);
45156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45157 LDKu8slice ser_ref;
45158 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45159 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45160 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
45161 *ret_conv = RouteHop_read(ser_ref);
45162 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45163 return (int64_t)ret_conv;
45166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45167 LDKRoute this_obj_conv;
45168 this_obj_conv.inner = (void*)(this_obj & (~1));
45169 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45171 Route_free(this_obj_conv);
45174 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
45175 LDKRoute this_ptr_conv;
45176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45177 this_ptr_conv.is_owned = false;
45178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45179 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
45180 jobjectArray ret_arr = NULL;
45181 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
45183 for (size_t m = 0; m < ret_var.datalen; m++) {
45184 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
45185 int64_tArray ret_conv_12_arr = NULL;
45186 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
45187 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
45188 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
45189 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
45190 int64_t ret_conv_12_conv_10_ref = 0;
45191 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45192 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
45194 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
45195 if (ret_conv_12_conv_10_var.is_owned) {
45196 ret_conv_12_conv_10_ref |= 1;
45198 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
45200 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
45201 FREE(ret_conv_12_var.data);
45202 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
45205 FREE(ret_var.data);
45209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
45210 LDKRoute this_ptr_conv;
45211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45212 this_ptr_conv.is_owned = false;
45213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45214 LDKCVec_CVec_RouteHopZZ val_constr;
45215 val_constr.datalen = (*env)->GetArrayLength(env, val);
45216 if (val_constr.datalen > 0)
45217 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45219 val_constr.data = NULL;
45220 for (size_t m = 0; m < val_constr.datalen; m++) {
45221 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
45222 LDKCVec_RouteHopZ val_conv_12_constr;
45223 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
45224 if (val_conv_12_constr.datalen > 0)
45225 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45227 val_conv_12_constr.data = NULL;
45228 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
45229 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
45230 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
45231 LDKRouteHop val_conv_12_conv_10_conv;
45232 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
45233 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
45234 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
45235 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
45236 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
45238 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
45239 val_constr.data[m] = val_conv_12_constr;
45241 Route_set_paths(&this_ptr_conv, val_constr);
45244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
45245 LDKRoute this_ptr_conv;
45246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45247 this_ptr_conv.is_owned = false;
45248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45249 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
45250 int64_t ret_ref = 0;
45251 if ((uintptr_t)ret_var.inner > 4096) {
45252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45255 ret_ref = (uintptr_t)ret_var.inner;
45256 if (ret_var.is_owned) {
45263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45264 LDKRoute this_ptr_conv;
45265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45266 this_ptr_conv.is_owned = false;
45267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45268 LDKPaymentParameters val_conv;
45269 val_conv.inner = (void*)(val & (~1));
45270 val_conv.is_owned = (val & 1) || (val == 0);
45271 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45272 val_conv = PaymentParameters_clone(&val_conv);
45273 Route_set_payment_params(&this_ptr_conv, val_conv);
45276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
45277 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
45278 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
45279 if (paths_arg_constr.datalen > 0)
45280 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45282 paths_arg_constr.data = NULL;
45283 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
45284 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
45285 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
45286 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
45287 if (paths_arg_conv_12_constr.datalen > 0)
45288 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45290 paths_arg_conv_12_constr.data = NULL;
45291 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
45292 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
45293 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
45294 LDKRouteHop paths_arg_conv_12_conv_10_conv;
45295 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
45296 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
45297 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
45298 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
45299 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
45301 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
45302 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
45304 LDKPaymentParameters payment_params_arg_conv;
45305 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
45306 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
45307 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45308 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45309 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
45310 int64_t ret_ref = 0;
45311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45314 ret_ref = (uintptr_t)ret_var.inner;
45315 if (ret_var.is_owned) {
45321 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
45322 LDKRoute ret_var = Route_clone(arg);
45323 int64_t ret_ref = 0;
45324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45327 ret_ref = (uintptr_t)ret_var.inner;
45328 if (ret_var.is_owned) {
45333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45335 arg_conv.inner = (void*)(arg & (~1));
45336 arg_conv.is_owned = false;
45337 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45338 int64_t ret_conv = Route_clone_ptr(&arg_conv);
45342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45343 LDKRoute orig_conv;
45344 orig_conv.inner = (void*)(orig & (~1));
45345 orig_conv.is_owned = false;
45346 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45347 LDKRoute ret_var = Route_clone(&orig_conv);
45348 int64_t ret_ref = 0;
45349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45352 ret_ref = (uintptr_t)ret_var.inner;
45353 if (ret_var.is_owned) {
45359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
45361 o_conv.inner = (void*)(o & (~1));
45362 o_conv.is_owned = false;
45363 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45364 int64_t ret_conv = Route_hash(&o_conv);
45368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45370 a_conv.inner = (void*)(a & (~1));
45371 a_conv.is_owned = false;
45372 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45374 b_conv.inner = (void*)(b & (~1));
45375 b_conv.is_owned = false;
45376 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45377 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
45381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
45382 LDKRoute this_arg_conv;
45383 this_arg_conv.inner = (void*)(this_arg & (~1));
45384 this_arg_conv.is_owned = false;
45385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45386 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
45390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
45391 LDKRoute this_arg_conv;
45392 this_arg_conv.inner = (void*)(this_arg & (~1));
45393 this_arg_conv.is_owned = false;
45394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45395 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
45399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
45401 obj_conv.inner = (void*)(obj & (~1));
45402 obj_conv.is_owned = false;
45403 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45404 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
45405 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45406 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45407 CVec_u8Z_free(ret_var);
45411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45412 LDKu8slice ser_ref;
45413 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45414 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45415 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
45416 *ret_conv = Route_read(ser_ref);
45417 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45418 return (int64_t)ret_conv;
45421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45422 LDKRouteParameters this_obj_conv;
45423 this_obj_conv.inner = (void*)(this_obj & (~1));
45424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45426 RouteParameters_free(this_obj_conv);
45429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
45430 LDKRouteParameters this_ptr_conv;
45431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45432 this_ptr_conv.is_owned = false;
45433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45434 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
45435 int64_t ret_ref = 0;
45436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45439 ret_ref = (uintptr_t)ret_var.inner;
45440 if (ret_var.is_owned) {
45446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45447 LDKRouteParameters this_ptr_conv;
45448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45449 this_ptr_conv.is_owned = false;
45450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45451 LDKPaymentParameters val_conv;
45452 val_conv.inner = (void*)(val & (~1));
45453 val_conv.is_owned = (val & 1) || (val == 0);
45454 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45455 val_conv = PaymentParameters_clone(&val_conv);
45456 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
45459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45460 LDKRouteParameters this_ptr_conv;
45461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45462 this_ptr_conv.is_owned = false;
45463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45464 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
45468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45469 LDKRouteParameters this_ptr_conv;
45470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45471 this_ptr_conv.is_owned = false;
45472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45473 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
45476 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45477 LDKRouteParameters this_ptr_conv;
45478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45479 this_ptr_conv.is_owned = false;
45480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45481 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
45485 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) {
45486 LDKRouteParameters this_ptr_conv;
45487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45488 this_ptr_conv.is_owned = false;
45489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45490 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
45493 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) {
45494 LDKPaymentParameters payment_params_arg_conv;
45495 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
45496 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
45497 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45498 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45499 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
45500 int64_t ret_ref = 0;
45501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45504 ret_ref = (uintptr_t)ret_var.inner;
45505 if (ret_var.is_owned) {
45511 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
45512 LDKRouteParameters ret_var = RouteParameters_clone(arg);
45513 int64_t ret_ref = 0;
45514 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45515 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45517 ret_ref = (uintptr_t)ret_var.inner;
45518 if (ret_var.is_owned) {
45523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45524 LDKRouteParameters arg_conv;
45525 arg_conv.inner = (void*)(arg & (~1));
45526 arg_conv.is_owned = false;
45527 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45528 int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
45532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45533 LDKRouteParameters orig_conv;
45534 orig_conv.inner = (void*)(orig & (~1));
45535 orig_conv.is_owned = false;
45536 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45537 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
45538 int64_t ret_ref = 0;
45539 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45540 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45542 ret_ref = (uintptr_t)ret_var.inner;
45543 if (ret_var.is_owned) {
45549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
45550 LDKRouteParameters obj_conv;
45551 obj_conv.inner = (void*)(obj & (~1));
45552 obj_conv.is_owned = false;
45553 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45554 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
45555 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45556 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45557 CVec_u8Z_free(ret_var);
45561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45562 LDKu8slice ser_ref;
45563 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45564 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45565 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
45566 *ret_conv = RouteParameters_read(ser_ref);
45567 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45568 return (int64_t)ret_conv;
45571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45572 LDKPaymentParameters this_obj_conv;
45573 this_obj_conv.inner = (void*)(this_obj & (~1));
45574 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45576 PaymentParameters_free(this_obj_conv);
45579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
45580 LDKPaymentParameters this_ptr_conv;
45581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45582 this_ptr_conv.is_owned = false;
45583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45584 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45585 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
45589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45590 LDKPaymentParameters this_ptr_conv;
45591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45592 this_ptr_conv.is_owned = false;
45593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45594 LDKPublicKey val_ref;
45595 CHECK((*env)->GetArrayLength(env, val) == 33);
45596 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45597 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
45600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45601 LDKPaymentParameters this_ptr_conv;
45602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45603 this_ptr_conv.is_owned = false;
45604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45605 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
45606 int64_t ret_ref = 0;
45607 if ((uintptr_t)ret_var.inner > 4096) {
45608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45611 ret_ref = (uintptr_t)ret_var.inner;
45612 if (ret_var.is_owned) {
45619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45620 LDKPaymentParameters this_ptr_conv;
45621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45622 this_ptr_conv.is_owned = false;
45623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45624 LDKInvoiceFeatures val_conv;
45625 val_conv.inner = (void*)(val & (~1));
45626 val_conv.is_owned = (val & 1) || (val == 0);
45627 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45628 val_conv = InvoiceFeatures_clone(&val_conv);
45629 PaymentParameters_set_features(&this_ptr_conv, val_conv);
45632 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
45633 LDKPaymentParameters this_ptr_conv;
45634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45635 this_ptr_conv.is_owned = false;
45636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45637 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
45638 int64_tArray ret_arr = NULL;
45639 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45640 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45641 for (size_t l = 0; l < ret_var.datalen; l++) {
45642 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45643 int64_t ret_conv_11_ref = 0;
45644 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45645 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45647 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
45648 if (ret_conv_11_var.is_owned) {
45649 ret_conv_11_ref |= 1;
45651 ret_arr_ptr[l] = ret_conv_11_ref;
45653 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45654 FREE(ret_var.data);
45658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45659 LDKPaymentParameters this_ptr_conv;
45660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45661 this_ptr_conv.is_owned = false;
45662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45663 LDKCVec_RouteHintZ val_constr;
45664 val_constr.datalen = (*env)->GetArrayLength(env, val);
45665 if (val_constr.datalen > 0)
45666 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45668 val_constr.data = NULL;
45669 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
45670 for (size_t l = 0; l < val_constr.datalen; l++) {
45671 int64_t val_conv_11 = val_vals[l];
45672 LDKRouteHint val_conv_11_conv;
45673 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
45674 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
45675 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
45676 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
45677 val_constr.data[l] = val_conv_11_conv;
45679 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
45680 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
45683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
45684 LDKPaymentParameters this_ptr_conv;
45685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45686 this_ptr_conv.is_owned = false;
45687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45688 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45689 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
45690 int64_t ret_ref = (uintptr_t)ret_copy;
45694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45695 LDKPaymentParameters this_ptr_conv;
45696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45697 this_ptr_conv.is_owned = false;
45698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45699 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
45700 CHECK_ACCESS(val_ptr);
45701 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45702 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
45703 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
45706 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45707 LDKPaymentParameters this_ptr_conv;
45708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45709 this_ptr_conv.is_owned = false;
45710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45711 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
45715 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) {
45716 LDKPaymentParameters this_ptr_conv;
45717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45718 this_ptr_conv.is_owned = false;
45719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45720 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
45723 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
45724 LDKPaymentParameters this_ptr_conv;
45725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45726 this_ptr_conv.is_owned = false;
45727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45728 int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
45732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
45733 LDKPaymentParameters this_ptr_conv;
45734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45735 this_ptr_conv.is_owned = false;
45736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45737 PaymentParameters_set_max_path_count(&this_ptr_conv, val);
45740 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr) {
45741 LDKPaymentParameters this_ptr_conv;
45742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45743 this_ptr_conv.is_owned = false;
45744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45745 int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
45749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
45750 LDKPaymentParameters this_ptr_conv;
45751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45752 this_ptr_conv.is_owned = false;
45753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45754 PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
45757 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
45758 LDKPaymentParameters this_ptr_conv;
45759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45760 this_ptr_conv.is_owned = false;
45761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45762 LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
45763 int64_tArray ret_arr = NULL;
45764 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45765 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45766 for (size_t g = 0; g < ret_var.datalen; g++) {
45767 int64_t ret_conv_6_conv = ret_var.data[g];
45768 ret_arr_ptr[g] = ret_conv_6_conv;
45770 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45771 FREE(ret_var.data);
45775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45776 LDKPaymentParameters this_ptr_conv;
45777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45778 this_ptr_conv.is_owned = false;
45779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45780 LDKCVec_u64Z val_constr;
45781 val_constr.datalen = (*env)->GetArrayLength(env, val);
45782 if (val_constr.datalen > 0)
45783 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45785 val_constr.data = NULL;
45786 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
45787 for (size_t g = 0; g < val_constr.datalen; g++) {
45788 int64_t val_conv_6 = val_vals[g];
45789 val_constr.data[g] = val_conv_6;
45791 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
45792 PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
45795 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, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) {
45796 LDKPublicKey payee_pubkey_arg_ref;
45797 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
45798 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
45799 LDKInvoiceFeatures features_arg_conv;
45800 features_arg_conv.inner = (void*)(features_arg & (~1));
45801 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
45802 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45803 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
45804 LDKCVec_RouteHintZ route_hints_arg_constr;
45805 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
45806 if (route_hints_arg_constr.datalen > 0)
45807 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45809 route_hints_arg_constr.data = NULL;
45810 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
45811 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
45812 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
45813 LDKRouteHint route_hints_arg_conv_11_conv;
45814 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
45815 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
45816 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
45817 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
45818 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
45820 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
45821 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
45822 CHECK_ACCESS(expiry_time_arg_ptr);
45823 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
45824 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
45825 LDKCVec_u64Z previously_failed_channels_arg_constr;
45826 previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
45827 if (previously_failed_channels_arg_constr.datalen > 0)
45828 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
45830 previously_failed_channels_arg_constr.data = NULL;
45831 int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
45832 for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
45833 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
45834 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
45836 (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
45837 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, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr);
45838 int64_t ret_ref = 0;
45839 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45840 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45842 ret_ref = (uintptr_t)ret_var.inner;
45843 if (ret_var.is_owned) {
45849 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
45850 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
45851 int64_t ret_ref = 0;
45852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45855 ret_ref = (uintptr_t)ret_var.inner;
45856 if (ret_var.is_owned) {
45861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45862 LDKPaymentParameters arg_conv;
45863 arg_conv.inner = (void*)(arg & (~1));
45864 arg_conv.is_owned = false;
45865 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45866 int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
45870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45871 LDKPaymentParameters orig_conv;
45872 orig_conv.inner = (void*)(orig & (~1));
45873 orig_conv.is_owned = false;
45874 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45875 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
45876 int64_t ret_ref = 0;
45877 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45878 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45880 ret_ref = (uintptr_t)ret_var.inner;
45881 if (ret_var.is_owned) {
45887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
45888 LDKPaymentParameters o_conv;
45889 o_conv.inner = (void*)(o & (~1));
45890 o_conv.is_owned = false;
45891 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45892 int64_t ret_conv = PaymentParameters_hash(&o_conv);
45896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45897 LDKPaymentParameters a_conv;
45898 a_conv.inner = (void*)(a & (~1));
45899 a_conv.is_owned = false;
45900 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45901 LDKPaymentParameters b_conv;
45902 b_conv.inner = (void*)(b & (~1));
45903 b_conv.is_owned = false;
45904 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45905 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
45909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
45910 LDKPaymentParameters obj_conv;
45911 obj_conv.inner = (void*)(obj & (~1));
45912 obj_conv.is_owned = false;
45913 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45914 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
45915 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45916 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45917 CVec_u8Z_free(ret_var);
45921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45922 LDKu8slice ser_ref;
45923 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45924 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45925 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
45926 *ret_conv = PaymentParameters_read(ser_ref);
45927 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45928 return (int64_t)ret_conv;
45931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
45932 LDKPublicKey payee_pubkey_ref;
45933 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
45934 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
45935 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
45936 int64_t ret_ref = 0;
45937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45940 ret_ref = (uintptr_t)ret_var.inner;
45941 if (ret_var.is_owned) {
45947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
45948 LDKPublicKey payee_pubkey_ref;
45949 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
45950 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
45951 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
45952 int64_t ret_ref = 0;
45953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45956 ret_ref = (uintptr_t)ret_var.inner;
45957 if (ret_var.is_owned) {
45963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45964 LDKRouteHint this_obj_conv;
45965 this_obj_conv.inner = (void*)(this_obj & (~1));
45966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45968 RouteHint_free(this_obj_conv);
45971 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45972 LDKRouteHint this_ptr_conv;
45973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45974 this_ptr_conv.is_owned = false;
45975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45976 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
45977 int64_tArray ret_arr = NULL;
45978 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45979 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45980 for (size_t o = 0; o < ret_var.datalen; o++) {
45981 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
45982 int64_t ret_conv_14_ref = 0;
45983 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45984 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45986 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
45987 if (ret_conv_14_var.is_owned) {
45988 ret_conv_14_ref |= 1;
45990 ret_arr_ptr[o] = ret_conv_14_ref;
45992 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45993 FREE(ret_var.data);
45997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45998 LDKRouteHint this_ptr_conv;
45999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46000 this_ptr_conv.is_owned = false;
46001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46002 LDKCVec_RouteHintHopZ val_constr;
46003 val_constr.datalen = (*env)->GetArrayLength(env, val);
46004 if (val_constr.datalen > 0)
46005 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46007 val_constr.data = NULL;
46008 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
46009 for (size_t o = 0; o < val_constr.datalen; o++) {
46010 int64_t val_conv_14 = val_vals[o];
46011 LDKRouteHintHop val_conv_14_conv;
46012 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
46013 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
46014 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
46015 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
46016 val_constr.data[o] = val_conv_14_conv;
46018 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
46019 RouteHint_set_a(&this_ptr_conv, val_constr);
46022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
46023 LDKCVec_RouteHintHopZ a_arg_constr;
46024 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
46025 if (a_arg_constr.datalen > 0)
46026 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46028 a_arg_constr.data = NULL;
46029 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
46030 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
46031 int64_t a_arg_conv_14 = a_arg_vals[o];
46032 LDKRouteHintHop a_arg_conv_14_conv;
46033 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
46034 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
46035 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
46036 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
46037 a_arg_constr.data[o] = a_arg_conv_14_conv;
46039 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
46040 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
46041 int64_t ret_ref = 0;
46042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46045 ret_ref = (uintptr_t)ret_var.inner;
46046 if (ret_var.is_owned) {
46052 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
46053 LDKRouteHint ret_var = RouteHint_clone(arg);
46054 int64_t ret_ref = 0;
46055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46058 ret_ref = (uintptr_t)ret_var.inner;
46059 if (ret_var.is_owned) {
46064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46065 LDKRouteHint arg_conv;
46066 arg_conv.inner = (void*)(arg & (~1));
46067 arg_conv.is_owned = false;
46068 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46069 int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
46073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46074 LDKRouteHint orig_conv;
46075 orig_conv.inner = (void*)(orig & (~1));
46076 orig_conv.is_owned = false;
46077 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46078 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
46079 int64_t ret_ref = 0;
46080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46083 ret_ref = (uintptr_t)ret_var.inner;
46084 if (ret_var.is_owned) {
46090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
46091 LDKRouteHint o_conv;
46092 o_conv.inner = (void*)(o & (~1));
46093 o_conv.is_owned = false;
46094 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46095 int64_t ret_conv = RouteHint_hash(&o_conv);
46099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46100 LDKRouteHint a_conv;
46101 a_conv.inner = (void*)(a & (~1));
46102 a_conv.is_owned = false;
46103 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46104 LDKRouteHint b_conv;
46105 b_conv.inner = (void*)(b & (~1));
46106 b_conv.is_owned = false;
46107 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46108 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
46112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
46113 LDKRouteHint obj_conv;
46114 obj_conv.inner = (void*)(obj & (~1));
46115 obj_conv.is_owned = false;
46116 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46117 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
46118 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46119 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46120 CVec_u8Z_free(ret_var);
46124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46125 LDKu8slice ser_ref;
46126 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46127 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46128 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
46129 *ret_conv = RouteHint_read(ser_ref);
46130 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46131 return (int64_t)ret_conv;
46134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46135 LDKRouteHintHop this_obj_conv;
46136 this_obj_conv.inner = (void*)(this_obj & (~1));
46137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46139 RouteHintHop_free(this_obj_conv);
46142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46143 LDKRouteHintHop this_ptr_conv;
46144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46145 this_ptr_conv.is_owned = false;
46146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46147 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46148 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
46152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46153 LDKRouteHintHop this_ptr_conv;
46154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46155 this_ptr_conv.is_owned = false;
46156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46157 LDKPublicKey val_ref;
46158 CHECK((*env)->GetArrayLength(env, val) == 33);
46159 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46160 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
46163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46164 LDKRouteHintHop this_ptr_conv;
46165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46166 this_ptr_conv.is_owned = false;
46167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46168 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
46172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46173 LDKRouteHintHop this_ptr_conv;
46174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46175 this_ptr_conv.is_owned = false;
46176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46177 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
46180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
46181 LDKRouteHintHop this_ptr_conv;
46182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46183 this_ptr_conv.is_owned = false;
46184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46185 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
46186 int64_t ret_ref = 0;
46187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46190 ret_ref = (uintptr_t)ret_var.inner;
46191 if (ret_var.is_owned) {
46197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46198 LDKRouteHintHop this_ptr_conv;
46199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46200 this_ptr_conv.is_owned = false;
46201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46202 LDKRoutingFees val_conv;
46203 val_conv.inner = (void*)(val & (~1));
46204 val_conv.is_owned = (val & 1) || (val == 0);
46205 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46206 val_conv = RoutingFees_clone(&val_conv);
46207 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
46210 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46211 LDKRouteHintHop this_ptr_conv;
46212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46213 this_ptr_conv.is_owned = false;
46214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46215 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
46219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46220 LDKRouteHintHop this_ptr_conv;
46221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46222 this_ptr_conv.is_owned = false;
46223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46224 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46228 LDKRouteHintHop this_ptr_conv;
46229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46230 this_ptr_conv.is_owned = false;
46231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46232 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46233 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
46234 int64_t ret_ref = (uintptr_t)ret_copy;
46238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46239 LDKRouteHintHop this_ptr_conv;
46240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46241 this_ptr_conv.is_owned = false;
46242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46243 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
46244 CHECK_ACCESS(val_ptr);
46245 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46246 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
46247 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
46250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46251 LDKRouteHintHop this_ptr_conv;
46252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46253 this_ptr_conv.is_owned = false;
46254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46255 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46256 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
46257 int64_t ret_ref = (uintptr_t)ret_copy;
46261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46262 LDKRouteHintHop this_ptr_conv;
46263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46264 this_ptr_conv.is_owned = false;
46265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46266 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
46267 CHECK_ACCESS(val_ptr);
46268 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46269 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
46270 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
46273 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) {
46274 LDKPublicKey src_node_id_arg_ref;
46275 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
46276 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
46277 LDKRoutingFees fees_arg_conv;
46278 fees_arg_conv.inner = (void*)(fees_arg & (~1));
46279 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
46280 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
46281 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
46282 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
46283 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
46284 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
46285 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
46286 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
46287 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
46288 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
46289 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
46290 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);
46291 int64_t ret_ref = 0;
46292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46295 ret_ref = (uintptr_t)ret_var.inner;
46296 if (ret_var.is_owned) {
46302 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
46303 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
46304 int64_t ret_ref = 0;
46305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46308 ret_ref = (uintptr_t)ret_var.inner;
46309 if (ret_var.is_owned) {
46314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46315 LDKRouteHintHop arg_conv;
46316 arg_conv.inner = (void*)(arg & (~1));
46317 arg_conv.is_owned = false;
46318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46319 int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
46323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46324 LDKRouteHintHop orig_conv;
46325 orig_conv.inner = (void*)(orig & (~1));
46326 orig_conv.is_owned = false;
46327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46328 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
46329 int64_t ret_ref = 0;
46330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46333 ret_ref = (uintptr_t)ret_var.inner;
46334 if (ret_var.is_owned) {
46340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
46341 LDKRouteHintHop o_conv;
46342 o_conv.inner = (void*)(o & (~1));
46343 o_conv.is_owned = false;
46344 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46345 int64_t ret_conv = RouteHintHop_hash(&o_conv);
46349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46350 LDKRouteHintHop a_conv;
46351 a_conv.inner = (void*)(a & (~1));
46352 a_conv.is_owned = false;
46353 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46354 LDKRouteHintHop b_conv;
46355 b_conv.inner = (void*)(b & (~1));
46356 b_conv.is_owned = false;
46357 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46358 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
46362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
46363 LDKRouteHintHop obj_conv;
46364 obj_conv.inner = (void*)(obj & (~1));
46365 obj_conv.is_owned = false;
46366 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46367 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
46368 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46369 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46370 CVec_u8Z_free(ret_var);
46374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46375 LDKu8slice ser_ref;
46376 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46377 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46378 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
46379 *ret_conv = RouteHintHop_read(ser_ref);
46380 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46381 return (int64_t)ret_conv;
46384 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_graph, int64_tArray first_hops, int64_t logger, int64_t scorer, int8_tArray random_seed_bytes) {
46385 LDKPublicKey our_node_pubkey_ref;
46386 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
46387 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
46388 LDKRouteParameters route_params_conv;
46389 route_params_conv.inner = (void*)(route_params & (~1));
46390 route_params_conv.is_owned = false;
46391 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46392 LDKNetworkGraph network_graph_conv;
46393 network_graph_conv.inner = (void*)(network_graph & (~1));
46394 network_graph_conv.is_owned = false;
46395 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46396 LDKCVec_ChannelDetailsZ first_hops_constr;
46397 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
46398 if (first_hops != NULL) {
46399 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
46400 if (first_hops_constr.datalen > 0)
46401 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
46403 first_hops_constr.data = NULL;
46404 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
46405 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
46406 int64_t first_hops_conv_16 = first_hops_vals[q];
46407 LDKChannelDetails first_hops_conv_16_conv;
46408 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
46409 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
46410 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
46411 first_hops_constr.data[q] = first_hops_conv_16_conv;
46413 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
46414 first_hops_ptr = &first_hops_constr;
46416 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46417 CHECK_ACCESS(logger_ptr);
46418 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46419 if (logger_conv.free == LDKLogger_JCalls_free) {
46420 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46421 LDKLogger_JCalls_cloned(&logger_conv);
46423 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
46424 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
46425 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
46426 unsigned char random_seed_bytes_arr[32];
46427 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46428 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
46429 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46430 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46431 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
46432 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
46433 return (int64_t)ret_conv;
46436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_build_1route_1from_1hops(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, jobjectArray hops, int64_t route_params, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
46437 LDKPublicKey our_node_pubkey_ref;
46438 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
46439 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
46440 LDKCVec_PublicKeyZ hops_constr;
46441 hops_constr.datalen = (*env)->GetArrayLength(env, hops);
46442 if (hops_constr.datalen > 0)
46443 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46445 hops_constr.data = NULL;
46446 for (size_t i = 0; i < hops_constr.datalen; i++) {
46447 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
46448 LDKPublicKey hops_conv_8_ref;
46449 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
46450 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
46451 hops_constr.data[i] = hops_conv_8_ref;
46453 LDKRouteParameters route_params_conv;
46454 route_params_conv.inner = (void*)(route_params & (~1));
46455 route_params_conv.is_owned = false;
46456 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46457 LDKNetworkGraph network_graph_conv;
46458 network_graph_conv.inner = (void*)(network_graph & (~1));
46459 network_graph_conv.is_owned = false;
46460 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46461 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46462 CHECK_ACCESS(logger_ptr);
46463 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46464 if (logger_conv.free == LDKLogger_JCalls_free) {
46465 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46466 LDKLogger_JCalls_cloned(&logger_conv);
46468 unsigned char random_seed_bytes_arr[32];
46469 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46470 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
46471 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46472 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46473 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
46474 return (int64_t)ret_conv;
46477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46478 if ((this_ptr & 1) != 0) return;
46479 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46480 CHECK_ACCESS(this_ptr_ptr);
46481 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
46482 FREE((void*)this_ptr);
46483 Score_free(this_ptr_conv);
46486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46487 if ((this_ptr & 1) != 0) return;
46488 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
46489 CHECK_ACCESS(this_ptr_ptr);
46490 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
46491 FREE((void*)this_ptr);
46492 LockableScore_free(this_ptr_conv);
46495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46496 LDKMultiThreadedLockableScore this_obj_conv;
46497 this_obj_conv.inner = (void*)(this_obj & (~1));
46498 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46500 MultiThreadedLockableScore_free(this_obj_conv);
46503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
46504 LDKMultiThreadedLockableScore obj_conv;
46505 obj_conv.inner = (void*)(obj & (~1));
46506 obj_conv.is_owned = false;
46507 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46508 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
46509 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46510 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46511 CVec_u8Z_free(ret_var);
46515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
46516 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
46517 CHECK_ACCESS(score_ptr);
46518 LDKScore score_conv = *(LDKScore*)(score_ptr);
46519 if (score_conv.free == LDKScore_JCalls_free) {
46520 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46521 LDKScore_JCalls_cloned(&score_conv);
46523 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
46524 int64_t ret_ref = 0;
46525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46528 ret_ref = (uintptr_t)ret_var.inner;
46529 if (ret_var.is_owned) {
46535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46536 LDKChannelUsage this_obj_conv;
46537 this_obj_conv.inner = (void*)(this_obj & (~1));
46538 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46540 ChannelUsage_free(this_obj_conv);
46543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46544 LDKChannelUsage this_ptr_conv;
46545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46546 this_ptr_conv.is_owned = false;
46547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46548 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
46552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46553 LDKChannelUsage this_ptr_conv;
46554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46555 this_ptr_conv.is_owned = false;
46556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46557 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
46560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46561 LDKChannelUsage this_ptr_conv;
46562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46563 this_ptr_conv.is_owned = false;
46564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46565 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
46569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46570 LDKChannelUsage this_ptr_conv;
46571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46572 this_ptr_conv.is_owned = false;
46573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46574 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
46577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
46578 LDKChannelUsage this_ptr_conv;
46579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46580 this_ptr_conv.is_owned = false;
46581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46582 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
46583 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
46584 int64_t ret_ref = (uintptr_t)ret_copy;
46588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46589 LDKChannelUsage this_ptr_conv;
46590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46591 this_ptr_conv.is_owned = false;
46592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46593 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
46594 CHECK_ACCESS(val_ptr);
46595 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
46596 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
46597 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
46600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1new(JNIEnv *env, jclass clz, int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
46601 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
46602 CHECK_ACCESS(effective_capacity_arg_ptr);
46603 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
46604 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
46605 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
46606 int64_t ret_ref = 0;
46607 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46608 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46610 ret_ref = (uintptr_t)ret_var.inner;
46611 if (ret_var.is_owned) {
46617 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
46618 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
46619 int64_t ret_ref = 0;
46620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46623 ret_ref = (uintptr_t)ret_var.inner;
46624 if (ret_var.is_owned) {
46629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46630 LDKChannelUsage arg_conv;
46631 arg_conv.inner = (void*)(arg & (~1));
46632 arg_conv.is_owned = false;
46633 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46634 int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
46638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46639 LDKChannelUsage orig_conv;
46640 orig_conv.inner = (void*)(orig & (~1));
46641 orig_conv.is_owned = false;
46642 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46643 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
46644 int64_t ret_ref = 0;
46645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46648 ret_ref = (uintptr_t)ret_var.inner;
46649 if (ret_var.is_owned) {
46655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46656 LDKFixedPenaltyScorer this_obj_conv;
46657 this_obj_conv.inner = (void*)(this_obj & (~1));
46658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46660 FixedPenaltyScorer_free(this_obj_conv);
46663 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
46664 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
46665 int64_t ret_ref = 0;
46666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46669 ret_ref = (uintptr_t)ret_var.inner;
46670 if (ret_var.is_owned) {
46675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46676 LDKFixedPenaltyScorer arg_conv;
46677 arg_conv.inner = (void*)(arg & (~1));
46678 arg_conv.is_owned = false;
46679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46680 int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
46684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46685 LDKFixedPenaltyScorer orig_conv;
46686 orig_conv.inner = (void*)(orig & (~1));
46687 orig_conv.is_owned = false;
46688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46689 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
46690 int64_t ret_ref = 0;
46691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46694 ret_ref = (uintptr_t)ret_var.inner;
46695 if (ret_var.is_owned) {
46701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
46702 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
46703 int64_t ret_ref = 0;
46704 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46705 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46707 ret_ref = (uintptr_t)ret_var.inner;
46708 if (ret_var.is_owned) {
46714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
46715 LDKFixedPenaltyScorer this_arg_conv;
46716 this_arg_conv.inner = (void*)(this_arg & (~1));
46717 this_arg_conv.is_owned = false;
46718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46719 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46720 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
46721 return (int64_t)ret_ret;
46724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
46725 LDKFixedPenaltyScorer obj_conv;
46726 obj_conv.inner = (void*)(obj & (~1));
46727 obj_conv.is_owned = false;
46728 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46729 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
46730 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46731 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46732 CVec_u8Z_free(ret_var);
46736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
46737 LDKu8slice ser_ref;
46738 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46739 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46740 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
46741 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
46742 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46743 return (int64_t)ret_conv;
46746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46747 LDKProbabilisticScorer this_obj_conv;
46748 this_obj_conv.inner = (void*)(this_obj & (~1));
46749 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46751 ProbabilisticScorer_free(this_obj_conv);
46754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46755 LDKProbabilisticScoringParameters this_obj_conv;
46756 this_obj_conv.inner = (void*)(this_obj & (~1));
46757 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46759 ProbabilisticScoringParameters_free(this_obj_conv);
46762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46763 LDKProbabilisticScoringParameters this_ptr_conv;
46764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46765 this_ptr_conv.is_owned = false;
46766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46767 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
46771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46772 LDKProbabilisticScoringParameters this_ptr_conv;
46773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46774 this_ptr_conv.is_owned = false;
46775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46776 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
46779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46780 LDKProbabilisticScoringParameters this_ptr_conv;
46781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46782 this_ptr_conv.is_owned = false;
46783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46784 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
46788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46789 LDKProbabilisticScoringParameters this_ptr_conv;
46790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46791 this_ptr_conv.is_owned = false;
46792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46793 ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
46796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46797 LDKProbabilisticScoringParameters this_ptr_conv;
46798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46799 this_ptr_conv.is_owned = false;
46800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46801 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
46805 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) {
46806 LDKProbabilisticScoringParameters this_ptr_conv;
46807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46808 this_ptr_conv.is_owned = false;
46809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46810 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
46813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
46814 LDKProbabilisticScoringParameters this_ptr_conv;
46815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46816 this_ptr_conv.is_owned = false;
46817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46818 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
46822 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) {
46823 LDKProbabilisticScoringParameters this_ptr_conv;
46824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46825 this_ptr_conv.is_owned = false;
46826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46827 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
46830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46831 LDKProbabilisticScoringParameters this_ptr_conv;
46832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46833 this_ptr_conv.is_owned = false;
46834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46835 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
46839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46840 LDKProbabilisticScoringParameters this_ptr_conv;
46841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46842 this_ptr_conv.is_owned = false;
46843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46844 ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
46847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46848 LDKProbabilisticScoringParameters this_ptr_conv;
46849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46850 this_ptr_conv.is_owned = false;
46851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46852 int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
46856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46857 LDKProbabilisticScoringParameters this_ptr_conv;
46858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46859 this_ptr_conv.is_owned = false;
46860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46861 ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
46864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46865 LDKProbabilisticScoringParameters this_ptr_conv;
46866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46867 this_ptr_conv.is_owned = false;
46868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46869 int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
46873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46874 LDKProbabilisticScoringParameters this_ptr_conv;
46875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
46876 this_ptr_conv.is_owned = false;
46877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46878 ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
46881 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
46882 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
46883 int64_t ret_ref = 0;
46884 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46885 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46887 ret_ref = (uintptr_t)ret_var.inner;
46888 if (ret_var.is_owned) {
46893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46894 LDKProbabilisticScoringParameters arg_conv;
46895 arg_conv.inner = (void*)(arg & (~1));
46896 arg_conv.is_owned = false;
46897 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46898 int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
46902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46903 LDKProbabilisticScoringParameters orig_conv;
46904 orig_conv.inner = (void*)(orig & (~1));
46905 orig_conv.is_owned = false;
46906 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46907 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
46908 int64_t ret_ref = 0;
46909 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46910 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46912 ret_ref = (uintptr_t)ret_var.inner;
46913 if (ret_var.is_owned) {
46919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph, int64_t logger) {
46920 LDKProbabilisticScoringParameters params_conv;
46921 params_conv.inner = (void*)(params & (~1));
46922 params_conv.is_owned = (params & 1) || (params == 0);
46923 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
46924 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
46925 LDKNetworkGraph network_graph_conv;
46926 network_graph_conv.inner = (void*)(network_graph & (~1));
46927 network_graph_conv.is_owned = false;
46928 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46929 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46930 CHECK_ACCESS(logger_ptr);
46931 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46932 if (logger_conv.free == LDKLogger_JCalls_free) {
46933 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46934 LDKLogger_JCalls_cloned(&logger_conv);
46936 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
46937 int64_t ret_ref = 0;
46938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46941 ret_ref = (uintptr_t)ret_var.inner;
46942 if (ret_var.is_owned) {
46948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
46949 LDKProbabilisticScorer this_arg_conv;
46950 this_arg_conv.inner = (void*)(this_arg & (~1));
46951 this_arg_conv.is_owned = false;
46952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46953 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
46956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estimated_1channel_1liquidity_1range(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
46957 LDKProbabilisticScorer this_arg_conv;
46958 this_arg_conv.inner = (void*)(this_arg & (~1));
46959 this_arg_conv.is_owned = false;
46960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46961 LDKNodeId target_conv;
46962 target_conv.inner = (void*)(target & (~1));
46963 target_conv.is_owned = false;
46964 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46965 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
46966 *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
46967 int64_t ret_ref = (uintptr_t)ret_copy;
46971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
46972 LDKProbabilisticScorer this_arg_conv;
46973 this_arg_conv.inner = (void*)(this_arg & (~1));
46974 this_arg_conv.is_owned = false;
46975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46976 LDKNodeId node_id_conv;
46977 node_id_conv.inner = (void*)(node_id & (~1));
46978 node_id_conv.is_owned = false;
46979 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
46980 ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
46983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
46984 LDKProbabilisticScorer this_arg_conv;
46985 this_arg_conv.inner = (void*)(this_arg & (~1));
46986 this_arg_conv.is_owned = false;
46987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46988 LDKNodeId node_id_conv;
46989 node_id_conv.inner = (void*)(node_id & (~1));
46990 node_id_conv.is_owned = false;
46991 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
46992 ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
46995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) {
46996 LDKProbabilisticScorer this_arg_conv;
46997 this_arg_conv.inner = (void*)(this_arg & (~1));
46998 this_arg_conv.is_owned = false;
46999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47000 LDKNodeId node_id_conv;
47001 node_id_conv.inner = (void*)(node_id & (~1));
47002 node_id_conv.is_owned = false;
47003 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47004 ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
47007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
47008 LDKProbabilisticScorer this_arg_conv;
47009 this_arg_conv.inner = (void*)(this_arg & (~1));
47010 this_arg_conv.is_owned = false;
47011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47012 LDKNodeId node_id_conv;
47013 node_id_conv.inner = (void*)(node_id & (~1));
47014 node_id_conv.is_owned = false;
47015 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47016 ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
47019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
47020 LDKProbabilisticScorer this_arg_conv;
47021 this_arg_conv.inner = (void*)(this_arg & (~1));
47022 this_arg_conv.is_owned = false;
47023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47024 ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
47027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) {
47028 LDKProbabilisticScoringParameters this_arg_conv;
47029 this_arg_conv.inner = (void*)(this_arg & (~1));
47030 this_arg_conv.is_owned = false;
47031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47032 LDKCVec_NodeIdZ node_ids_constr;
47033 node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
47034 if (node_ids_constr.datalen > 0)
47035 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
47037 node_ids_constr.data = NULL;
47038 int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
47039 for (size_t i = 0; i < node_ids_constr.datalen; i++) {
47040 int64_t node_ids_conv_8 = node_ids_vals[i];
47041 LDKNodeId node_ids_conv_8_conv;
47042 node_ids_conv_8_conv.inner = (void*)(node_ids_conv_8 & (~1));
47043 node_ids_conv_8_conv.is_owned = (node_ids_conv_8 & 1) || (node_ids_conv_8 == 0);
47044 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
47045 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
47046 node_ids_constr.data[i] = node_ids_conv_8_conv;
47048 (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
47049 ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
47052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
47053 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
47054 int64_t ret_ref = 0;
47055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47058 ret_ref = (uintptr_t)ret_var.inner;
47059 if (ret_var.is_owned) {
47065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
47066 LDKProbabilisticScorer this_arg_conv;
47067 this_arg_conv.inner = (void*)(this_arg & (~1));
47068 this_arg_conv.is_owned = false;
47069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47070 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
47071 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
47072 return (int64_t)ret_ret;
47075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
47076 LDKProbabilisticScorer obj_conv;
47077 obj_conv.inner = (void*)(obj & (~1));
47078 obj_conv.is_owned = false;
47079 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47080 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
47081 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47082 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47083 CVec_u8Z_free(ret_var);
47087 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, int64_t arg_c) {
47088 LDKu8slice ser_ref;
47089 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47090 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47091 LDKProbabilisticScoringParameters arg_a_conv;
47092 arg_a_conv.inner = (void*)(arg_a & (~1));
47093 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
47094 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
47095 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
47096 LDKNetworkGraph arg_b_conv;
47097 arg_b_conv.inner = (void*)(arg_b & (~1));
47098 arg_b_conv.is_owned = false;
47099 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
47100 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
47101 CHECK_ACCESS(arg_c_ptr);
47102 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
47103 if (arg_c_conv.free == LDKLogger_JCalls_free) {
47104 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47105 LDKLogger_JCalls_cloned(&arg_c_conv);
47107 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
47108 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
47109 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47110 return (int64_t)ret_conv;
47113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47114 LDKFilesystemPersister this_obj_conv;
47115 this_obj_conv.inner = (void*)(this_obj & (~1));
47116 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47118 FilesystemPersister_free(this_obj_conv);
47121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
47122 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
47123 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
47124 int64_t ret_ref = 0;
47125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47128 ret_ref = (uintptr_t)ret_var.inner;
47129 if (ret_var.is_owned) {
47135 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
47136 LDKFilesystemPersister this_arg_conv;
47137 this_arg_conv.inner = (void*)(this_arg & (~1));
47138 this_arg_conv.is_owned = false;
47139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47140 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
47141 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
47147 LDKFilesystemPersister this_arg_conv;
47148 this_arg_conv.inner = (void*)(this_arg & (~1));
47149 this_arg_conv.is_owned = false;
47150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47151 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
47152 CHECK_ACCESS(keys_manager_ptr);
47153 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47154 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47155 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47156 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47158 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
47159 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
47160 return (int64_t)ret_conv;
47163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47164 LDKBackgroundProcessor this_obj_conv;
47165 this_obj_conv.inner = (void*)(this_obj & (~1));
47166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47168 BackgroundProcessor_free(this_obj_conv);
47171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47172 if ((this_ptr & 1) != 0) return;
47173 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47174 CHECK_ACCESS(this_ptr_ptr);
47175 LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
47176 FREE((void*)this_ptr);
47177 GossipSync_free(this_ptr_conv);
47180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
47181 LDKP2PGossipSync a_conv;
47182 a_conv.inner = (void*)(a & (~1));
47183 a_conv.is_owned = false;
47184 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47185 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47186 *ret_copy = GossipSync_p2_p(&a_conv);
47187 int64_t ret_ref = (uintptr_t)ret_copy;
47191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
47192 LDKRapidGossipSync a_conv;
47193 a_conv.inner = (void*)(a & (~1));
47194 a_conv.is_owned = false;
47195 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47196 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47197 *ret_copy = GossipSync_rapid(&a_conv);
47198 int64_t ret_ref = (uintptr_t)ret_copy;
47202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
47203 LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47204 *ret_copy = GossipSync_none();
47205 int64_t ret_ref = (uintptr_t)ret_copy;
47209 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 gossip_sync, int64_t peer_manager, int64_t logger, int64_t scorer) {
47210 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
47211 CHECK_ACCESS(persister_ptr);
47212 LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
47213 if (persister_conv.free == LDKPersister_JCalls_free) {
47214 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47215 LDKPersister_JCalls_cloned(&persister_conv);
47217 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
47218 CHECK_ACCESS(event_handler_ptr);
47219 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47220 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47221 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47222 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47224 LDKChainMonitor chain_monitor_conv;
47225 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
47226 chain_monitor_conv.is_owned = false;
47227 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
47228 LDKChannelManager channel_manager_conv;
47229 channel_manager_conv.inner = (void*)(channel_manager & (~1));
47230 channel_manager_conv.is_owned = false;
47231 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
47232 void* gossip_sync_ptr = (void*)(((uintptr_t)gossip_sync) & ~1);
47233 CHECK_ACCESS(gossip_sync_ptr);
47234 LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
47235 // WARNING: we may need a move here but no clone is available for LDKGossipSync
47236 LDKPeerManager peer_manager_conv;
47237 peer_manager_conv.inner = (void*)(peer_manager & (~1));
47238 peer_manager_conv.is_owned = false;
47239 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
47240 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
47241 CHECK_ACCESS(logger_ptr);
47242 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47243 if (logger_conv.free == LDKLogger_JCalls_free) {
47244 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47245 LDKLogger_JCalls_cloned(&logger_conv);
47247 LDKMultiThreadedLockableScore scorer_conv;
47248 scorer_conv.inner = (void*)(scorer & (~1));
47249 scorer_conv.is_owned = (scorer & 1) || (scorer == 0);
47250 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
47251 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, gossip_sync_conv, &peer_manager_conv, logger_conv, scorer_conv);
47252 int64_t ret_ref = 0;
47253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47256 ret_ref = (uintptr_t)ret_var.inner;
47257 if (ret_var.is_owned) {
47263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
47264 LDKBackgroundProcessor this_arg_conv;
47265 this_arg_conv.inner = (void*)(this_arg & (~1));
47266 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47268 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
47269 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
47270 *ret_conv = BackgroundProcessor_join(this_arg_conv);
47271 return (int64_t)ret_conv;
47274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
47275 LDKBackgroundProcessor this_arg_conv;
47276 this_arg_conv.inner = (void*)(this_arg & (~1));
47277 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
47278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47279 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
47280 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
47281 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
47282 return (int64_t)ret_conv;
47285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47286 if ((this_ptr & 1) != 0) return;
47287 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47288 CHECK_ACCESS(this_ptr_ptr);
47289 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
47290 FREE((void*)this_ptr);
47291 ParseError_free(this_ptr_conv);
47294 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
47295 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47296 *ret_copy = ParseError_clone(arg);
47297 int64_t ret_ref = (uintptr_t)ret_copy;
47300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47301 LDKParseError* arg_conv = (LDKParseError*)arg;
47302 int64_t ret_conv = ParseError_clone_ptr(arg_conv);
47306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47307 LDKParseError* orig_conv = (LDKParseError*)orig;
47308 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47309 *ret_copy = ParseError_clone(orig_conv);
47310 int64_t ret_ref = (uintptr_t)ret_copy;
47314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
47315 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
47316 CHECK_ACCESS(a_ptr);
47317 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
47318 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
47319 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47320 *ret_copy = ParseError_bech32_error(a_conv);
47321 int64_t ret_ref = (uintptr_t)ret_copy;
47325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
47327 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47328 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
47329 int64_t ret_ref = (uintptr_t)ret_copy;
47333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
47334 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
47335 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47336 *ret_copy = ParseError_malformed_signature(a_conv);
47337 int64_t ret_ref = (uintptr_t)ret_copy;
47341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
47342 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47343 *ret_copy = ParseError_bad_prefix();
47344 int64_t ret_ref = (uintptr_t)ret_copy;
47348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
47349 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47350 *ret_copy = ParseError_unknown_currency();
47351 int64_t ret_ref = (uintptr_t)ret_copy;
47355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
47356 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47357 *ret_copy = ParseError_unknown_si_prefix();
47358 int64_t ret_ref = (uintptr_t)ret_copy;
47362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
47363 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47364 *ret_copy = ParseError_malformed_hrp();
47365 int64_t ret_ref = (uintptr_t)ret_copy;
47369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
47370 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47371 *ret_copy = ParseError_too_short_data_part();
47372 int64_t ret_ref = (uintptr_t)ret_copy;
47376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
47377 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47378 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
47379 int64_t ret_ref = (uintptr_t)ret_copy;
47383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
47385 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47386 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
47387 int64_t ret_ref = (uintptr_t)ret_copy;
47391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
47392 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47393 *ret_copy = ParseError_padding_error();
47394 int64_t ret_ref = (uintptr_t)ret_copy;
47398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
47399 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47400 *ret_copy = ParseError_integer_overflow_error();
47401 int64_t ret_ref = (uintptr_t)ret_copy;
47405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
47406 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47407 *ret_copy = ParseError_invalid_seg_wit_program_length();
47408 int64_t ret_ref = (uintptr_t)ret_copy;
47412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
47413 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47414 *ret_copy = ParseError_invalid_pub_key_hash_length();
47415 int64_t ret_ref = (uintptr_t)ret_copy;
47419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
47420 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47421 *ret_copy = ParseError_invalid_script_hash_length();
47422 int64_t ret_ref = (uintptr_t)ret_copy;
47426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
47427 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47428 *ret_copy = ParseError_invalid_recovery_id();
47429 int64_t ret_ref = (uintptr_t)ret_copy;
47433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
47434 LDKStr a_conv = java_to_owned_str(env, a);
47435 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47436 *ret_copy = ParseError_invalid_slice_length(a_conv);
47437 int64_t ret_ref = (uintptr_t)ret_copy;
47441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
47442 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47443 *ret_copy = ParseError_skip();
47444 int64_t ret_ref = (uintptr_t)ret_copy;
47448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47449 if ((this_ptr & 1) != 0) return;
47450 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
47451 CHECK_ACCESS(this_ptr_ptr);
47452 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
47453 FREE((void*)this_ptr);
47454 ParseOrSemanticError_free(this_ptr_conv);
47457 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
47458 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47459 *ret_copy = ParseOrSemanticError_clone(arg);
47460 int64_t ret_ref = (uintptr_t)ret_copy;
47463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47464 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
47465 int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
47469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47470 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
47471 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47472 *ret_copy = ParseOrSemanticError_clone(orig_conv);
47473 int64_t ret_ref = (uintptr_t)ret_copy;
47477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
47478 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
47479 CHECK_ACCESS(a_ptr);
47480 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
47481 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
47482 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47483 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
47484 int64_t ret_ref = (uintptr_t)ret_copy;
47488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
47489 LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
47490 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
47491 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
47492 int64_t ret_ref = (uintptr_t)ret_copy;
47496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47497 LDKInvoice this_obj_conv;
47498 this_obj_conv.inner = (void*)(this_obj & (~1));
47499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47501 Invoice_free(this_obj_conv);
47504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47506 a_conv.inner = (void*)(a & (~1));
47507 a_conv.is_owned = false;
47508 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47510 b_conv.inner = (void*)(b & (~1));
47511 b_conv.is_owned = false;
47512 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47513 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
47517 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
47518 LDKInvoice ret_var = Invoice_clone(arg);
47519 int64_t ret_ref = 0;
47520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47523 ret_ref = (uintptr_t)ret_var.inner;
47524 if (ret_var.is_owned) {
47529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47530 LDKInvoice arg_conv;
47531 arg_conv.inner = (void*)(arg & (~1));
47532 arg_conv.is_owned = false;
47533 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47534 int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
47538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47539 LDKInvoice orig_conv;
47540 orig_conv.inner = (void*)(orig & (~1));
47541 orig_conv.is_owned = false;
47542 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47543 LDKInvoice ret_var = Invoice_clone(&orig_conv);
47544 int64_t ret_ref = 0;
47545 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47546 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47548 ret_ref = (uintptr_t)ret_var.inner;
47549 if (ret_var.is_owned) {
47555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47556 LDKSignedRawInvoice this_obj_conv;
47557 this_obj_conv.inner = (void*)(this_obj & (~1));
47558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47560 SignedRawInvoice_free(this_obj_conv);
47563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47564 LDKSignedRawInvoice a_conv;
47565 a_conv.inner = (void*)(a & (~1));
47566 a_conv.is_owned = false;
47567 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47568 LDKSignedRawInvoice b_conv;
47569 b_conv.inner = (void*)(b & (~1));
47570 b_conv.is_owned = false;
47571 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47572 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
47576 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
47577 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
47578 int64_t ret_ref = 0;
47579 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47580 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47582 ret_ref = (uintptr_t)ret_var.inner;
47583 if (ret_var.is_owned) {
47588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47589 LDKSignedRawInvoice arg_conv;
47590 arg_conv.inner = (void*)(arg & (~1));
47591 arg_conv.is_owned = false;
47592 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47593 int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
47597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47598 LDKSignedRawInvoice orig_conv;
47599 orig_conv.inner = (void*)(orig & (~1));
47600 orig_conv.is_owned = false;
47601 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47602 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
47603 int64_t ret_ref = 0;
47604 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47605 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47607 ret_ref = (uintptr_t)ret_var.inner;
47608 if (ret_var.is_owned) {
47614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47615 LDKRawInvoice this_obj_conv;
47616 this_obj_conv.inner = (void*)(this_obj & (~1));
47617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47619 RawInvoice_free(this_obj_conv);
47622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
47623 LDKRawInvoice this_ptr_conv;
47624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47625 this_ptr_conv.is_owned = false;
47626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47627 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
47628 int64_t ret_ref = 0;
47629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47632 ret_ref = (uintptr_t)ret_var.inner;
47633 if (ret_var.is_owned) {
47639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47640 LDKRawInvoice this_ptr_conv;
47641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47642 this_ptr_conv.is_owned = false;
47643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47644 LDKRawDataPart val_conv;
47645 val_conv.inner = (void*)(val & (~1));
47646 val_conv.is_owned = (val & 1) || (val == 0);
47647 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47648 val_conv = RawDataPart_clone(&val_conv);
47649 RawInvoice_set_data(&this_ptr_conv, val_conv);
47652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47653 LDKRawInvoice a_conv;
47654 a_conv.inner = (void*)(a & (~1));
47655 a_conv.is_owned = false;
47656 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47657 LDKRawInvoice b_conv;
47658 b_conv.inner = (void*)(b & (~1));
47659 b_conv.is_owned = false;
47660 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47661 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
47665 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
47666 LDKRawInvoice ret_var = RawInvoice_clone(arg);
47667 int64_t ret_ref = 0;
47668 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47669 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47671 ret_ref = (uintptr_t)ret_var.inner;
47672 if (ret_var.is_owned) {
47677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47678 LDKRawInvoice arg_conv;
47679 arg_conv.inner = (void*)(arg & (~1));
47680 arg_conv.is_owned = false;
47681 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47682 int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
47686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47687 LDKRawInvoice orig_conv;
47688 orig_conv.inner = (void*)(orig & (~1));
47689 orig_conv.is_owned = false;
47690 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47691 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
47692 int64_t ret_ref = 0;
47693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47696 ret_ref = (uintptr_t)ret_var.inner;
47697 if (ret_var.is_owned) {
47703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47704 LDKRawDataPart this_obj_conv;
47705 this_obj_conv.inner = (void*)(this_obj & (~1));
47706 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47708 RawDataPart_free(this_obj_conv);
47711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
47712 LDKRawDataPart this_ptr_conv;
47713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47714 this_ptr_conv.is_owned = false;
47715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47716 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
47717 int64_t ret_ref = 0;
47718 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47719 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47721 ret_ref = (uintptr_t)ret_var.inner;
47722 if (ret_var.is_owned) {
47728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47729 LDKRawDataPart this_ptr_conv;
47730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
47731 this_ptr_conv.is_owned = false;
47732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47733 LDKPositiveTimestamp val_conv;
47734 val_conv.inner = (void*)(val & (~1));
47735 val_conv.is_owned = (val & 1) || (val == 0);
47736 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47737 val_conv = PositiveTimestamp_clone(&val_conv);
47738 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
47741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47742 LDKRawDataPart a_conv;
47743 a_conv.inner = (void*)(a & (~1));
47744 a_conv.is_owned = false;
47745 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47746 LDKRawDataPart b_conv;
47747 b_conv.inner = (void*)(b & (~1));
47748 b_conv.is_owned = false;
47749 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47750 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
47754 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
47755 LDKRawDataPart ret_var = RawDataPart_clone(arg);
47756 int64_t ret_ref = 0;
47757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47760 ret_ref = (uintptr_t)ret_var.inner;
47761 if (ret_var.is_owned) {
47766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47767 LDKRawDataPart arg_conv;
47768 arg_conv.inner = (void*)(arg & (~1));
47769 arg_conv.is_owned = false;
47770 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47771 int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
47775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47776 LDKRawDataPart orig_conv;
47777 orig_conv.inner = (void*)(orig & (~1));
47778 orig_conv.is_owned = false;
47779 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47780 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
47781 int64_t ret_ref = 0;
47782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47785 ret_ref = (uintptr_t)ret_var.inner;
47786 if (ret_var.is_owned) {
47792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47793 LDKPositiveTimestamp this_obj_conv;
47794 this_obj_conv.inner = (void*)(this_obj & (~1));
47795 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47797 PositiveTimestamp_free(this_obj_conv);
47800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47801 LDKPositiveTimestamp a_conv;
47802 a_conv.inner = (void*)(a & (~1));
47803 a_conv.is_owned = false;
47804 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47805 LDKPositiveTimestamp b_conv;
47806 b_conv.inner = (void*)(b & (~1));
47807 b_conv.is_owned = false;
47808 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47809 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
47813 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
47814 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
47815 int64_t ret_ref = 0;
47816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47819 ret_ref = (uintptr_t)ret_var.inner;
47820 if (ret_var.is_owned) {
47825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47826 LDKPositiveTimestamp arg_conv;
47827 arg_conv.inner = (void*)(arg & (~1));
47828 arg_conv.is_owned = false;
47829 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47830 int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
47834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47835 LDKPositiveTimestamp orig_conv;
47836 orig_conv.inner = (void*)(orig & (~1));
47837 orig_conv.is_owned = false;
47838 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47839 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
47840 int64_t ret_ref = 0;
47841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47844 ret_ref = (uintptr_t)ret_var.inner;
47845 if (ret_var.is_owned) {
47851 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47852 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
47853 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
47857 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
47858 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
47862 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
47863 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
47867 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
47868 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
47872 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
47873 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
47877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47878 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
47879 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
47880 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
47884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
47885 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
47886 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
47890 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47891 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
47892 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
47896 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
47897 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
47901 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
47902 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
47906 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
47907 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
47911 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
47912 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
47916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
47917 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
47921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
47922 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
47923 int64_t ret_conv = Currency_hash(o_conv);
47927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47928 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
47929 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
47930 jboolean ret_conv = Currency_eq(a_conv, b_conv);
47934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47935 LDKSha256 this_obj_conv;
47936 this_obj_conv.inner = (void*)(this_obj & (~1));
47937 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
47938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47939 Sha256_free(this_obj_conv);
47942 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
47943 LDKSha256 ret_var = Sha256_clone(arg);
47944 int64_t ret_ref = 0;
47945 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47946 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47948 ret_ref = (uintptr_t)ret_var.inner;
47949 if (ret_var.is_owned) {
47954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47955 LDKSha256 arg_conv;
47956 arg_conv.inner = (void*)(arg & (~1));
47957 arg_conv.is_owned = false;
47958 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47959 int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
47963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47964 LDKSha256 orig_conv;
47965 orig_conv.inner = (void*)(orig & (~1));
47966 orig_conv.is_owned = false;
47967 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47968 LDKSha256 ret_var = Sha256_clone(&orig_conv);
47969 int64_t ret_ref = 0;
47970 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
47971 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
47972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47973 ret_ref = (uintptr_t)ret_var.inner;
47974 if (ret_var.is_owned) {
47980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
47982 o_conv.inner = (void*)(o & (~1));
47983 o_conv.is_owned = false;
47984 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47985 int64_t ret_conv = Sha256_hash(&o_conv);
47989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47991 a_conv.inner = (void*)(a & (~1));
47992 a_conv.is_owned = false;
47993 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47995 b_conv.inner = (void*)(b & (~1));
47996 b_conv.is_owned = false;
47997 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47998 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
48002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48003 LDKDescription this_obj_conv;
48004 this_obj_conv.inner = (void*)(this_obj & (~1));
48005 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48007 Description_free(this_obj_conv);
48010 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
48011 LDKDescription ret_var = Description_clone(arg);
48012 int64_t ret_ref = 0;
48013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48016 ret_ref = (uintptr_t)ret_var.inner;
48017 if (ret_var.is_owned) {
48022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48023 LDKDescription arg_conv;
48024 arg_conv.inner = (void*)(arg & (~1));
48025 arg_conv.is_owned = false;
48026 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48027 int64_t ret_conv = Description_clone_ptr(&arg_conv);
48031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48032 LDKDescription orig_conv;
48033 orig_conv.inner = (void*)(orig & (~1));
48034 orig_conv.is_owned = false;
48035 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48036 LDKDescription ret_var = Description_clone(&orig_conv);
48037 int64_t ret_ref = 0;
48038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48041 ret_ref = (uintptr_t)ret_var.inner;
48042 if (ret_var.is_owned) {
48048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
48049 LDKDescription o_conv;
48050 o_conv.inner = (void*)(o & (~1));
48051 o_conv.is_owned = false;
48052 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48053 int64_t ret_conv = Description_hash(&o_conv);
48057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48058 LDKDescription a_conv;
48059 a_conv.inner = (void*)(a & (~1));
48060 a_conv.is_owned = false;
48061 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48062 LDKDescription b_conv;
48063 b_conv.inner = (void*)(b & (~1));
48064 b_conv.is_owned = false;
48065 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48066 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
48070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48071 LDKPayeePubKey this_obj_conv;
48072 this_obj_conv.inner = (void*)(this_obj & (~1));
48073 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48075 PayeePubKey_free(this_obj_conv);
48078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
48079 LDKPayeePubKey this_ptr_conv;
48080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48081 this_ptr_conv.is_owned = false;
48082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48083 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48084 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
48088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48089 LDKPayeePubKey this_ptr_conv;
48090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48091 this_ptr_conv.is_owned = false;
48092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48093 LDKPublicKey val_ref;
48094 CHECK((*env)->GetArrayLength(env, val) == 33);
48095 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48096 PayeePubKey_set_a(&this_ptr_conv, val_ref);
48099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
48100 LDKPublicKey a_arg_ref;
48101 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
48102 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
48103 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
48104 int64_t ret_ref = 0;
48105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48108 ret_ref = (uintptr_t)ret_var.inner;
48109 if (ret_var.is_owned) {
48115 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
48116 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
48117 int64_t ret_ref = 0;
48118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48121 ret_ref = (uintptr_t)ret_var.inner;
48122 if (ret_var.is_owned) {
48127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48128 LDKPayeePubKey arg_conv;
48129 arg_conv.inner = (void*)(arg & (~1));
48130 arg_conv.is_owned = false;
48131 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48132 int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
48136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48137 LDKPayeePubKey orig_conv;
48138 orig_conv.inner = (void*)(orig & (~1));
48139 orig_conv.is_owned = false;
48140 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48141 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
48142 int64_t ret_ref = 0;
48143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48146 ret_ref = (uintptr_t)ret_var.inner;
48147 if (ret_var.is_owned) {
48153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
48154 LDKPayeePubKey o_conv;
48155 o_conv.inner = (void*)(o & (~1));
48156 o_conv.is_owned = false;
48157 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48158 int64_t ret_conv = PayeePubKey_hash(&o_conv);
48162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48163 LDKPayeePubKey a_conv;
48164 a_conv.inner = (void*)(a & (~1));
48165 a_conv.is_owned = false;
48166 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48167 LDKPayeePubKey b_conv;
48168 b_conv.inner = (void*)(b & (~1));
48169 b_conv.is_owned = false;
48170 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48171 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
48175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48176 LDKExpiryTime this_obj_conv;
48177 this_obj_conv.inner = (void*)(this_obj & (~1));
48178 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48180 ExpiryTime_free(this_obj_conv);
48183 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
48184 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
48185 int64_t ret_ref = 0;
48186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48189 ret_ref = (uintptr_t)ret_var.inner;
48190 if (ret_var.is_owned) {
48195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48196 LDKExpiryTime arg_conv;
48197 arg_conv.inner = (void*)(arg & (~1));
48198 arg_conv.is_owned = false;
48199 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48200 int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
48204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48205 LDKExpiryTime orig_conv;
48206 orig_conv.inner = (void*)(orig & (~1));
48207 orig_conv.is_owned = false;
48208 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48209 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
48210 int64_t ret_ref = 0;
48211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48214 ret_ref = (uintptr_t)ret_var.inner;
48215 if (ret_var.is_owned) {
48221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
48222 LDKExpiryTime o_conv;
48223 o_conv.inner = (void*)(o & (~1));
48224 o_conv.is_owned = false;
48225 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48226 int64_t ret_conv = ExpiryTime_hash(&o_conv);
48230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48231 LDKExpiryTime a_conv;
48232 a_conv.inner = (void*)(a & (~1));
48233 a_conv.is_owned = false;
48234 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48235 LDKExpiryTime b_conv;
48236 b_conv.inner = (void*)(b & (~1));
48237 b_conv.is_owned = false;
48238 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48239 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
48243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48244 LDKMinFinalCltvExpiry this_obj_conv;
48245 this_obj_conv.inner = (void*)(this_obj & (~1));
48246 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48248 MinFinalCltvExpiry_free(this_obj_conv);
48251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
48252 LDKMinFinalCltvExpiry this_ptr_conv;
48253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48254 this_ptr_conv.is_owned = false;
48255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48256 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
48260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48261 LDKMinFinalCltvExpiry this_ptr_conv;
48262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
48263 this_ptr_conv.is_owned = false;
48264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48265 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
48268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
48269 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
48270 int64_t ret_ref = 0;
48271 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48272 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48274 ret_ref = (uintptr_t)ret_var.inner;
48275 if (ret_var.is_owned) {
48281 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
48282 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
48283 int64_t ret_ref = 0;
48284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48287 ret_ref = (uintptr_t)ret_var.inner;
48288 if (ret_var.is_owned) {
48293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48294 LDKMinFinalCltvExpiry arg_conv;
48295 arg_conv.inner = (void*)(arg & (~1));
48296 arg_conv.is_owned = false;
48297 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48298 int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
48302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48303 LDKMinFinalCltvExpiry orig_conv;
48304 orig_conv.inner = (void*)(orig & (~1));
48305 orig_conv.is_owned = false;
48306 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48307 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
48308 int64_t ret_ref = 0;
48309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48312 ret_ref = (uintptr_t)ret_var.inner;
48313 if (ret_var.is_owned) {
48319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
48320 LDKMinFinalCltvExpiry o_conv;
48321 o_conv.inner = (void*)(o & (~1));
48322 o_conv.is_owned = false;
48323 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48324 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
48328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48329 LDKMinFinalCltvExpiry a_conv;
48330 a_conv.inner = (void*)(a & (~1));
48331 a_conv.is_owned = false;
48332 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48333 LDKMinFinalCltvExpiry b_conv;
48334 b_conv.inner = (void*)(b & (~1));
48335 b_conv.is_owned = false;
48336 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48337 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
48341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48342 if ((this_ptr & 1) != 0) return;
48343 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
48344 CHECK_ACCESS(this_ptr_ptr);
48345 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
48346 FREE((void*)this_ptr);
48347 Fallback_free(this_ptr_conv);
48350 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
48351 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48352 *ret_copy = Fallback_clone(arg);
48353 int64_t ret_ref = (uintptr_t)ret_copy;
48356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48357 LDKFallback* arg_conv = (LDKFallback*)arg;
48358 int64_t ret_conv = Fallback_clone_ptr(arg_conv);
48362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48363 LDKFallback* orig_conv = (LDKFallback*)orig;
48364 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48365 *ret_copy = Fallback_clone(orig_conv);
48366 int64_t ret_ref = (uintptr_t)ret_copy;
48370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
48372 LDKCVec_u8Z program_ref;
48373 program_ref.datalen = (*env)->GetArrayLength(env, program);
48374 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
48375 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
48376 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48377 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
48378 int64_t ret_ref = (uintptr_t)ret_copy;
48382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
48383 LDKTwentyBytes a_ref;
48384 CHECK((*env)->GetArrayLength(env, a) == 20);
48385 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
48386 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48387 *ret_copy = Fallback_pub_key_hash(a_ref);
48388 int64_t ret_ref = (uintptr_t)ret_copy;
48392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
48393 LDKTwentyBytes a_ref;
48394 CHECK((*env)->GetArrayLength(env, a) == 20);
48395 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
48396 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48397 *ret_copy = Fallback_script_hash(a_ref);
48398 int64_t ret_ref = (uintptr_t)ret_copy;
48402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
48403 LDKFallback* o_conv = (LDKFallback*)o;
48404 int64_t ret_conv = Fallback_hash(o_conv);
48408 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48409 LDKFallback* a_conv = (LDKFallback*)a;
48410 LDKFallback* b_conv = (LDKFallback*)b;
48411 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
48415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48416 LDKInvoiceSignature this_obj_conv;
48417 this_obj_conv.inner = (void*)(this_obj & (~1));
48418 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48420 InvoiceSignature_free(this_obj_conv);
48423 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
48424 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
48425 int64_t ret_ref = 0;
48426 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48427 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48429 ret_ref = (uintptr_t)ret_var.inner;
48430 if (ret_var.is_owned) {
48435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48436 LDKInvoiceSignature arg_conv;
48437 arg_conv.inner = (void*)(arg & (~1));
48438 arg_conv.is_owned = false;
48439 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48440 int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
48444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48445 LDKInvoiceSignature orig_conv;
48446 orig_conv.inner = (void*)(orig & (~1));
48447 orig_conv.is_owned = false;
48448 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48449 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
48450 int64_t ret_ref = 0;
48451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48454 ret_ref = (uintptr_t)ret_var.inner;
48455 if (ret_var.is_owned) {
48461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48462 LDKInvoiceSignature a_conv;
48463 a_conv.inner = (void*)(a & (~1));
48464 a_conv.is_owned = false;
48465 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48466 LDKInvoiceSignature b_conv;
48467 b_conv.inner = (void*)(b & (~1));
48468 b_conv.is_owned = false;
48469 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48470 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
48474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48475 LDKPrivateRoute this_obj_conv;
48476 this_obj_conv.inner = (void*)(this_obj & (~1));
48477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
48478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48479 PrivateRoute_free(this_obj_conv);
48482 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
48483 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
48484 int64_t ret_ref = 0;
48485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48488 ret_ref = (uintptr_t)ret_var.inner;
48489 if (ret_var.is_owned) {
48494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48495 LDKPrivateRoute arg_conv;
48496 arg_conv.inner = (void*)(arg & (~1));
48497 arg_conv.is_owned = false;
48498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48499 int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
48503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48504 LDKPrivateRoute orig_conv;
48505 orig_conv.inner = (void*)(orig & (~1));
48506 orig_conv.is_owned = false;
48507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48508 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
48509 int64_t ret_ref = 0;
48510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48513 ret_ref = (uintptr_t)ret_var.inner;
48514 if (ret_var.is_owned) {
48520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
48521 LDKPrivateRoute o_conv;
48522 o_conv.inner = (void*)(o & (~1));
48523 o_conv.is_owned = false;
48524 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48525 int64_t ret_conv = PrivateRoute_hash(&o_conv);
48529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48530 LDKPrivateRoute a_conv;
48531 a_conv.inner = (void*)(a & (~1));
48532 a_conv.is_owned = false;
48533 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48534 LDKPrivateRoute b_conv;
48535 b_conv.inner = (void*)(b & (~1));
48536 b_conv.is_owned = false;
48537 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48538 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
48542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
48543 LDKSignedRawInvoice this_arg_conv;
48544 this_arg_conv.inner = (void*)(this_arg & (~1));
48545 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
48546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48547 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
48548 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
48549 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
48550 return ((int64_t)ret_conv);
48553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
48554 LDKSignedRawInvoice this_arg_conv;
48555 this_arg_conv.inner = (void*)(this_arg & (~1));
48556 this_arg_conv.is_owned = false;
48557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48558 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
48559 int64_t ret_ref = 0;
48560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48563 ret_ref = (uintptr_t)ret_var.inner;
48564 if (ret_var.is_owned) {
48570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48571 LDKSignedRawInvoice this_arg_conv;
48572 this_arg_conv.inner = (void*)(this_arg & (~1));
48573 this_arg_conv.is_owned = false;
48574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48575 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48576 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
48580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
48581 LDKSignedRawInvoice this_arg_conv;
48582 this_arg_conv.inner = (void*)(this_arg & (~1));
48583 this_arg_conv.is_owned = false;
48584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48585 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
48586 int64_t ret_ref = 0;
48587 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48588 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48590 ret_ref = (uintptr_t)ret_var.inner;
48591 if (ret_var.is_owned) {
48597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48598 LDKSignedRawInvoice this_arg_conv;
48599 this_arg_conv.inner = (void*)(this_arg & (~1));
48600 this_arg_conv.is_owned = false;
48601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48602 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
48603 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
48604 return (int64_t)ret_conv;
48607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
48608 LDKSignedRawInvoice this_arg_conv;
48609 this_arg_conv.inner = (void*)(this_arg & (~1));
48610 this_arg_conv.is_owned = false;
48611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48612 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
48616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48617 LDKRawInvoice this_arg_conv;
48618 this_arg_conv.inner = (void*)(this_arg & (~1));
48619 this_arg_conv.is_owned = false;
48620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48621 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48622 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
48626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48627 LDKRawInvoice this_arg_conv;
48628 this_arg_conv.inner = (void*)(this_arg & (~1));
48629 this_arg_conv.is_owned = false;
48630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48631 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
48632 int64_t ret_ref = 0;
48633 if ((uintptr_t)ret_var.inner > 4096) {
48634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48637 ret_ref = (uintptr_t)ret_var.inner;
48638 if (ret_var.is_owned) {
48645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
48646 LDKRawInvoice this_arg_conv;
48647 this_arg_conv.inner = (void*)(this_arg & (~1));
48648 this_arg_conv.is_owned = false;
48649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48650 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
48651 int64_t ret_ref = 0;
48652 if ((uintptr_t)ret_var.inner > 4096) {
48653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48656 ret_ref = (uintptr_t)ret_var.inner;
48657 if (ret_var.is_owned) {
48664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48665 LDKRawInvoice this_arg_conv;
48666 this_arg_conv.inner = (void*)(this_arg & (~1));
48667 this_arg_conv.is_owned = false;
48668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48669 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
48670 int64_t ret_ref = 0;
48671 if ((uintptr_t)ret_var.inner > 4096) {
48672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48675 ret_ref = (uintptr_t)ret_var.inner;
48676 if (ret_var.is_owned) {
48683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48684 LDKRawInvoice this_arg_conv;
48685 this_arg_conv.inner = (void*)(this_arg & (~1));
48686 this_arg_conv.is_owned = false;
48687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48688 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
48689 int64_t ret_ref = 0;
48690 if ((uintptr_t)ret_var.inner > 4096) {
48691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48694 ret_ref = (uintptr_t)ret_var.inner;
48695 if (ret_var.is_owned) {
48702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
48703 LDKRawInvoice this_arg_conv;
48704 this_arg_conv.inner = (void*)(this_arg & (~1));
48705 this_arg_conv.is_owned = false;
48706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48707 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
48708 int64_t ret_ref = 0;
48709 if ((uintptr_t)ret_var.inner > 4096) {
48710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48713 ret_ref = (uintptr_t)ret_var.inner;
48714 if (ret_var.is_owned) {
48721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
48722 LDKRawInvoice this_arg_conv;
48723 this_arg_conv.inner = (void*)(this_arg & (~1));
48724 this_arg_conv.is_owned = false;
48725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48726 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
48727 int64_t ret_ref = 0;
48728 if ((uintptr_t)ret_var.inner > 4096) {
48729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48732 ret_ref = (uintptr_t)ret_var.inner;
48733 if (ret_var.is_owned) {
48740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
48741 LDKRawInvoice this_arg_conv;
48742 this_arg_conv.inner = (void*)(this_arg & (~1));
48743 this_arg_conv.is_owned = false;
48744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48745 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48746 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
48750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48751 LDKRawInvoice this_arg_conv;
48752 this_arg_conv.inner = (void*)(this_arg & (~1));
48753 this_arg_conv.is_owned = false;
48754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48755 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
48756 int64_t ret_ref = 0;
48757 if ((uintptr_t)ret_var.inner > 4096) {
48758 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48759 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48761 ret_ref = (uintptr_t)ret_var.inner;
48762 if (ret_var.is_owned) {
48769 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
48770 LDKRawInvoice this_arg_conv;
48771 this_arg_conv.inner = (void*)(this_arg & (~1));
48772 this_arg_conv.is_owned = false;
48773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48774 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
48775 int64_tArray ret_arr = NULL;
48776 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48777 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48778 for (size_t o = 0; o < ret_var.datalen; o++) {
48779 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
48780 int64_t ret_conv_14_ref = 0;
48781 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48782 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
48784 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
48785 if (ret_conv_14_var.is_owned) {
48786 ret_conv_14_ref |= 1;
48788 ret_arr_ptr[o] = ret_conv_14_ref;
48790 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48791 FREE(ret_var.data);
48795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
48796 LDKRawInvoice this_arg_conv;
48797 this_arg_conv.inner = (void*)(this_arg & (~1));
48798 this_arg_conv.is_owned = false;
48799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48800 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
48801 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
48802 int64_t ret_ref = (uintptr_t)ret_copy;
48806 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
48807 LDKRawInvoice this_arg_conv;
48808 this_arg_conv.inner = (void*)(this_arg & (~1));
48809 this_arg_conv.is_owned = false;
48810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48811 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
48815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
48816 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48817 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
48818 return (int64_t)ret_conv;
48821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
48822 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48823 *ret_conv = PositiveTimestamp_from_system_time(time);
48824 return (int64_t)ret_conv;
48827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
48828 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48829 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
48830 return (int64_t)ret_conv;
48833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
48834 LDKPositiveTimestamp this_arg_conv;
48835 this_arg_conv.inner = (void*)(this_arg & (~1));
48836 this_arg_conv.is_owned = false;
48837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48838 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
48842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
48843 LDKPositiveTimestamp this_arg_conv;
48844 this_arg_conv.inner = (void*)(this_arg & (~1));
48845 this_arg_conv.is_owned = false;
48846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48847 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
48851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
48852 LDKPositiveTimestamp this_arg_conv;
48853 this_arg_conv.inner = (void*)(this_arg & (~1));
48854 this_arg_conv.is_owned = false;
48855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48856 int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
48860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
48861 LDKInvoice this_arg_conv;
48862 this_arg_conv.inner = (void*)(this_arg & (~1));
48863 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
48864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48865 this_arg_conv = Invoice_clone(&this_arg_conv);
48866 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
48867 int64_t ret_ref = 0;
48868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48871 ret_ref = (uintptr_t)ret_var.inner;
48872 if (ret_var.is_owned) {
48878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
48879 LDKInvoice this_arg_conv;
48880 this_arg_conv.inner = (void*)(this_arg & (~1));
48881 this_arg_conv.is_owned = false;
48882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48883 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
48884 *ret_conv = Invoice_check_signature(&this_arg_conv);
48885 return (int64_t)ret_conv;
48888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
48889 LDKSignedRawInvoice signed_invoice_conv;
48890 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
48891 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
48892 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
48893 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
48894 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
48895 *ret_conv = Invoice_from_signed(signed_invoice_conv);
48896 return (int64_t)ret_conv;
48899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
48900 LDKInvoice this_arg_conv;
48901 this_arg_conv.inner = (void*)(this_arg & (~1));
48902 this_arg_conv.is_owned = false;
48903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48904 int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
48908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
48909 LDKInvoice this_arg_conv;
48910 this_arg_conv.inner = (void*)(this_arg & (~1));
48911 this_arg_conv.is_owned = false;
48912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48913 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
48917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
48918 LDKInvoice this_arg_conv;
48919 this_arg_conv.inner = (void*)(this_arg & (~1));
48920 this_arg_conv.is_owned = false;
48921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48922 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48923 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
48927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48928 LDKInvoice this_arg_conv;
48929 this_arg_conv.inner = (void*)(this_arg & (~1));
48930 this_arg_conv.is_owned = false;
48931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48932 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48933 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
48937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
48938 LDKInvoice this_arg_conv;
48939 this_arg_conv.inner = (void*)(this_arg & (~1));
48940 this_arg_conv.is_owned = false;
48941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48942 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48943 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
48947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48948 LDKInvoice this_arg_conv;
48949 this_arg_conv.inner = (void*)(this_arg & (~1));
48950 this_arg_conv.is_owned = false;
48951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48952 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
48953 int64_t ret_ref = 0;
48954 if ((uintptr_t)ret_var.inner > 4096) {
48955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
48956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
48957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48958 ret_ref = (uintptr_t)ret_var.inner;
48959 if (ret_var.is_owned) {
48966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
48967 LDKInvoice this_arg_conv;
48968 this_arg_conv.inner = (void*)(this_arg & (~1));
48969 this_arg_conv.is_owned = false;
48970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48971 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48972 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
48976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
48977 LDKInvoice this_arg_conv;
48978 this_arg_conv.inner = (void*)(this_arg & (~1));
48979 this_arg_conv.is_owned = false;
48980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48981 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
48985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
48986 LDKInvoice this_arg_conv;
48987 this_arg_conv.inner = (void*)(this_arg & (~1));
48988 this_arg_conv.is_owned = false;
48989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48990 jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
48994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
48995 LDKInvoice this_arg_conv;
48996 this_arg_conv.inner = (void*)(this_arg & (~1));
48997 this_arg_conv.is_owned = false;
48998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48999 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
49003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
49004 LDKInvoice this_arg_conv;
49005 this_arg_conv.inner = (void*)(this_arg & (~1));
49006 this_arg_conv.is_owned = false;
49007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49008 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
49012 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
49013 LDKInvoice this_arg_conv;
49014 this_arg_conv.inner = (void*)(this_arg & (~1));
49015 this_arg_conv.is_owned = false;
49016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49017 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
49018 int64_tArray ret_arr = NULL;
49019 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49020 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49021 for (size_t o = 0; o < ret_var.datalen; o++) {
49022 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49023 int64_t ret_conv_14_ref = 0;
49024 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49025 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49027 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
49028 if (ret_conv_14_var.is_owned) {
49029 ret_conv_14_ref |= 1;
49031 ret_arr_ptr[o] = ret_conv_14_ref;
49033 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49034 FREE(ret_var.data);
49038 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
49039 LDKInvoice this_arg_conv;
49040 this_arg_conv.inner = (void*)(this_arg & (~1));
49041 this_arg_conv.is_owned = false;
49042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49043 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
49044 int64_tArray ret_arr = NULL;
49045 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49046 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49047 for (size_t l = 0; l < ret_var.datalen; l++) {
49048 LDKRouteHint ret_conv_11_var = ret_var.data[l];
49049 int64_t ret_conv_11_ref = 0;
49050 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49051 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
49053 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
49054 if (ret_conv_11_var.is_owned) {
49055 ret_conv_11_ref |= 1;
49057 ret_arr_ptr[l] = ret_conv_11_ref;
49059 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49060 FREE(ret_var.data);
49064 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
49065 LDKInvoice this_arg_conv;
49066 this_arg_conv.inner = (void*)(this_arg & (~1));
49067 this_arg_conv.is_owned = false;
49068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49069 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
49073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
49074 LDKInvoice this_arg_conv;
49075 this_arg_conv.inner = (void*)(this_arg & (~1));
49076 this_arg_conv.is_owned = false;
49077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49078 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49079 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
49080 int64_t ret_ref = (uintptr_t)ret_copy;
49084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
49085 LDKStr description_conv = java_to_owned_str(env, description);
49086 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
49087 *ret_conv = Description_new(description_conv);
49088 return (int64_t)ret_conv;
49091 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
49092 LDKDescription this_arg_conv;
49093 this_arg_conv.inner = (void*)(this_arg & (~1));
49094 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
49095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49096 this_arg_conv = Description_clone(&this_arg_conv);
49097 LDKStr ret_str = Description_into_inner(this_arg_conv);
49098 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
49104 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
49105 int64_t ret_ref = 0;
49106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49109 ret_ref = (uintptr_t)ret_var.inner;
49110 if (ret_var.is_owned) {
49116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
49117 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
49118 int64_t ret_ref = 0;
49119 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49120 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49122 ret_ref = (uintptr_t)ret_var.inner;
49123 if (ret_var.is_owned) {
49129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
49130 LDKExpiryTime this_arg_conv;
49131 this_arg_conv.inner = (void*)(this_arg & (~1));
49132 this_arg_conv.is_owned = false;
49133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49134 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
49138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
49139 LDKExpiryTime this_arg_conv;
49140 this_arg_conv.inner = (void*)(this_arg & (~1));
49141 this_arg_conv.is_owned = false;
49142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49143 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
49147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
49148 LDKRouteHint hops_conv;
49149 hops_conv.inner = (void*)(hops & (~1));
49150 hops_conv.is_owned = (hops & 1) || (hops == 0);
49151 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
49152 hops_conv = RouteHint_clone(&hops_conv);
49153 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
49154 *ret_conv = PrivateRoute_new(hops_conv);
49155 return (int64_t)ret_conv;
49158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
49159 LDKPrivateRoute this_arg_conv;
49160 this_arg_conv.inner = (void*)(this_arg & (~1));
49161 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
49162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49163 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
49164 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
49165 int64_t ret_ref = 0;
49166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49169 ret_ref = (uintptr_t)ret_var.inner;
49170 if (ret_var.is_owned) {
49176 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49177 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
49178 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
49182 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
49183 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
49187 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
49188 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
49192 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
49193 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
49197 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
49198 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
49202 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
49203 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
49207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49208 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
49209 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
49210 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
49214 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49215 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
49216 LDKStr ret_str = CreationError_to_str(o_conv);
49217 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49222 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49223 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
49224 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
49228 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
49229 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
49233 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
49234 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
49238 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
49239 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
49243 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
49244 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
49248 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
49249 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
49253 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
49254 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
49258 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
49259 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
49263 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
49264 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
49268 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
49269 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
49273 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
49274 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
49278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49279 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
49280 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
49281 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
49285 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49286 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
49287 LDKStr ret_str = SemanticError_to_str(o_conv);
49288 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49294 if ((this_ptr & 1) != 0) return;
49295 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49296 CHECK_ACCESS(this_ptr_ptr);
49297 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
49298 FREE((void*)this_ptr);
49299 SignOrCreationError_free(this_ptr_conv);
49302 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
49303 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49304 *ret_copy = SignOrCreationError_clone(arg);
49305 int64_t ret_ref = (uintptr_t)ret_copy;
49308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49309 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
49310 int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
49314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49315 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
49316 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49317 *ret_copy = SignOrCreationError_clone(orig_conv);
49318 int64_t ret_ref = (uintptr_t)ret_copy;
49322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
49323 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49324 *ret_copy = SignOrCreationError_sign_error();
49325 int64_t ret_ref = (uintptr_t)ret_copy;
49329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
49330 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
49331 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49332 *ret_copy = SignOrCreationError_creation_error(a_conv);
49333 int64_t ret_ref = (uintptr_t)ret_copy;
49337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49338 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
49339 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
49340 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
49344 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49345 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
49346 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
49347 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49353 LDKInvoicePayer this_obj_conv;
49354 this_obj_conv.inner = (void*)(this_obj & (~1));
49355 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
49356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49357 InvoicePayer_free(this_obj_conv);
49360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49361 if ((this_ptr & 1) != 0) return;
49362 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49363 CHECK_ACCESS(this_ptr_ptr);
49364 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
49365 FREE((void*)this_ptr);
49366 Payer_free(this_ptr_conv);
49369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49370 if ((this_ptr & 1) != 0) return;
49371 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49372 CHECK_ACCESS(this_ptr_ptr);
49373 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
49374 FREE((void*)this_ptr);
49375 Router_free(this_ptr_conv);
49378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49379 if ((this_ptr & 1) != 0) return;
49380 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49381 CHECK_ACCESS(this_ptr_ptr);
49382 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
49383 FREE((void*)this_ptr);
49384 Retry_free(this_ptr_conv);
49387 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
49388 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49389 *ret_copy = Retry_clone(arg);
49390 int64_t ret_ref = (uintptr_t)ret_copy;
49393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49394 LDKRetry* arg_conv = (LDKRetry*)arg;
49395 int64_t ret_conv = Retry_clone_ptr(arg_conv);
49399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49400 LDKRetry* orig_conv = (LDKRetry*)orig;
49401 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49402 *ret_copy = Retry_clone(orig_conv);
49403 int64_t ret_ref = (uintptr_t)ret_copy;
49407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
49408 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49409 *ret_copy = Retry_attempts(a);
49410 int64_t ret_ref = (uintptr_t)ret_copy;
49414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
49415 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49416 *ret_copy = Retry_timeout(a);
49417 int64_t ret_ref = (uintptr_t)ret_copy;
49421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49422 LDKRetry* a_conv = (LDKRetry*)a;
49423 LDKRetry* b_conv = (LDKRetry*)b;
49424 jboolean ret_conv = Retry_eq(a_conv, b_conv);
49428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
49429 LDKRetry* o_conv = (LDKRetry*)o;
49430 int64_t ret_conv = Retry_hash(o_conv);
49434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49435 if ((this_ptr & 1) != 0) return;
49436 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49437 CHECK_ACCESS(this_ptr_ptr);
49438 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
49439 FREE((void*)this_ptr);
49440 PaymentError_free(this_ptr_conv);
49443 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
49444 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49445 *ret_copy = PaymentError_clone(arg);
49446 int64_t ret_ref = (uintptr_t)ret_copy;
49449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49450 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
49451 int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
49455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49456 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
49457 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49458 *ret_copy = PaymentError_clone(orig_conv);
49459 int64_t ret_ref = (uintptr_t)ret_copy;
49463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
49464 LDKStr a_conv = java_to_owned_str(env, a);
49465 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49466 *ret_copy = PaymentError_invoice(a_conv);
49467 int64_t ret_ref = (uintptr_t)ret_copy;
49471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
49472 LDKLightningError a_conv;
49473 a_conv.inner = (void*)(a & (~1));
49474 a_conv.is_owned = (a & 1) || (a == 0);
49475 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49476 a_conv = LightningError_clone(&a_conv);
49477 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49478 *ret_copy = PaymentError_routing(a_conv);
49479 int64_t ret_ref = (uintptr_t)ret_copy;
49483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
49484 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
49485 CHECK_ACCESS(a_ptr);
49486 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
49487 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
49488 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49489 *ret_copy = PaymentError_sending(a_conv);
49490 int64_t ret_ref = (uintptr_t)ret_copy;
49494 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) {
49495 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
49496 CHECK_ACCESS(payer_ptr);
49497 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
49498 if (payer_conv.free == LDKPayer_JCalls_free) {
49499 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49500 LDKPayer_JCalls_cloned(&payer_conv);
49502 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
49503 CHECK_ACCESS(router_ptr);
49504 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
49505 if (router_conv.free == LDKRouter_JCalls_free) {
49506 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49507 LDKRouter_JCalls_cloned(&router_conv);
49509 LDKMultiThreadedLockableScore scorer_conv;
49510 scorer_conv.inner = (void*)(scorer & (~1));
49511 scorer_conv.is_owned = false;
49512 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
49513 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
49514 CHECK_ACCESS(logger_ptr);
49515 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49516 if (logger_conv.free == LDKLogger_JCalls_free) {
49517 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49518 LDKLogger_JCalls_cloned(&logger_conv);
49520 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
49521 CHECK_ACCESS(event_handler_ptr);
49522 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
49523 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
49524 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49525 LDKEventHandler_JCalls_cloned(&event_handler_conv);
49527 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
49528 CHECK_ACCESS(retry_ptr);
49529 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
49530 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
49531 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
49532 int64_t ret_ref = 0;
49533 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49534 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49536 ret_ref = (uintptr_t)ret_var.inner;
49537 if (ret_var.is_owned) {
49543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
49544 LDKInvoicePayer this_arg_conv;
49545 this_arg_conv.inner = (void*)(this_arg & (~1));
49546 this_arg_conv.is_owned = false;
49547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49548 LDKInvoice invoice_conv;
49549 invoice_conv.inner = (void*)(invoice & (~1));
49550 invoice_conv.is_owned = false;
49551 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
49552 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
49553 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
49554 return (int64_t)ret_conv;
49557 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) {
49558 LDKInvoicePayer this_arg_conv;
49559 this_arg_conv.inner = (void*)(this_arg & (~1));
49560 this_arg_conv.is_owned = false;
49561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49562 LDKInvoice invoice_conv;
49563 invoice_conv.inner = (void*)(invoice & (~1));
49564 invoice_conv.is_owned = false;
49565 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
49566 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
49567 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
49568 return (int64_t)ret_conv;
49571 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) {
49572 LDKInvoicePayer this_arg_conv;
49573 this_arg_conv.inner = (void*)(this_arg & (~1));
49574 this_arg_conv.is_owned = false;
49575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49576 LDKPublicKey pubkey_ref;
49577 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
49578 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
49579 LDKThirtyTwoBytes payment_preimage_ref;
49580 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
49581 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
49582 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
49583 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
49584 return (int64_t)ret_conv;
49587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
49588 LDKInvoicePayer this_arg_conv;
49589 this_arg_conv.inner = (void*)(this_arg & (~1));
49590 this_arg_conv.is_owned = false;
49591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49592 unsigned char payment_hash_arr[32];
49593 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
49594 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
49595 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
49596 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
49599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49600 LDKInvoicePayer this_arg_conv;
49601 this_arg_conv.inner = (void*)(this_arg & (~1));
49602 this_arg_conv.is_owned = false;
49603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49604 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
49605 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
49606 return (int64_t)ret_ret;
49609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
49610 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49611 CHECK_ACCESS(amt_msat_ptr);
49612 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49613 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49614 LDKThirtyTwoBytes payment_hash_ref;
49615 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
49616 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
49617 LDKStr description_conv = java_to_owned_str(env, description);
49618 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
49619 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
49620 if (phantom_route_hints_constr.datalen > 0)
49621 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
49623 phantom_route_hints_constr.data = NULL;
49624 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
49625 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
49626 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
49627 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
49628 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
49629 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
49630 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
49631 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
49632 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
49634 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
49635 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49636 CHECK_ACCESS(keys_manager_ptr);
49637 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49638 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49639 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49640 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49642 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49643 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49644 *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, keys_manager_conv, network_conv);
49645 return (int64_t)ret_conv;
49648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
49649 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49650 CHECK_ACCESS(amt_msat_ptr);
49651 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49652 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49653 LDKThirtyTwoBytes payment_hash_ref;
49654 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
49655 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
49656 LDKSha256 description_hash_conv;
49657 description_hash_conv.inner = (void*)(description_hash & (~1));
49658 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
49659 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
49660 description_hash_conv = Sha256_clone(&description_hash_conv);
49661 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
49662 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
49663 if (phantom_route_hints_constr.datalen > 0)
49664 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
49666 phantom_route_hints_constr.data = NULL;
49667 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
49668 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
49669 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
49670 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
49671 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
49672 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
49673 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
49674 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
49675 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
49677 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
49678 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49679 CHECK_ACCESS(keys_manager_ptr);
49680 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49681 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49682 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49683 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49685 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49686 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49687 *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, keys_manager_conv, network_conv);
49688 return (int64_t)ret_conv;
49691 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, int32_t invoice_expiry_delta_secs) {
49692 LDKChannelManager channelmanager_conv;
49693 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49694 channelmanager_conv.is_owned = false;
49695 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49696 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49697 CHECK_ACCESS(keys_manager_ptr);
49698 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49699 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49700 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49701 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49703 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49704 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49705 CHECK_ACCESS(amt_msat_ptr);
49706 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49707 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49708 LDKStr description_conv = java_to_owned_str(env, description);
49709 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49710 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
49711 return (int64_t)ret_conv;
49714 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, int32_t invoice_expiry_delta_secs) {
49715 LDKChannelManager channelmanager_conv;
49716 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49717 channelmanager_conv.is_owned = false;
49718 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49719 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49720 CHECK_ACCESS(keys_manager_ptr);
49721 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49722 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49723 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49724 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49726 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49727 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49728 CHECK_ACCESS(amt_msat_ptr);
49729 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49730 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49731 LDKSha256 description_hash_conv;
49732 description_hash_conv.inner = (void*)(description_hash & (~1));
49733 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
49734 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
49735 description_hash_conv = Sha256_clone(&description_hash_conv);
49736 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49737 *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs);
49738 return (int64_t)ret_conv;
49741 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, int32_t invoice_expiry_delta_secs) {
49742 LDKChannelManager channelmanager_conv;
49743 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49744 channelmanager_conv.is_owned = false;
49745 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49746 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49747 CHECK_ACCESS(keys_manager_ptr);
49748 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49749 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49750 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49751 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49753 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49754 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49755 CHECK_ACCESS(amt_msat_ptr);
49756 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49757 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49758 LDKSha256 description_hash_conv;
49759 description_hash_conv.inner = (void*)(description_hash & (~1));
49760 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
49761 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
49762 description_hash_conv = Sha256_clone(&description_hash_conv);
49763 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49764 *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, invoice_expiry_delta_secs);
49765 return (int64_t)ret_conv;
49768 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, int32_t invoice_expiry_delta_secs) {
49769 LDKChannelManager channelmanager_conv;
49770 channelmanager_conv.inner = (void*)(channelmanager & (~1));
49771 channelmanager_conv.is_owned = false;
49772 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
49773 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
49774 CHECK_ACCESS(keys_manager_ptr);
49775 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
49776 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
49777 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49778 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
49780 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
49781 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
49782 CHECK_ACCESS(amt_msat_ptr);
49783 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
49784 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
49785 LDKStr description_conv = java_to_owned_str(env, description);
49786 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
49787 *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, invoice_expiry_delta_secs);
49788 return (int64_t)ret_conv;
49791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49792 LDKDefaultRouter this_obj_conv;
49793 this_obj_conv.inner = (void*)(this_obj & (~1));
49794 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
49795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49796 DefaultRouter_free(this_obj_conv);
49799 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) {
49800 LDKNetworkGraph network_graph_conv;
49801 network_graph_conv.inner = (void*)(network_graph & (~1));
49802 network_graph_conv.is_owned = false;
49803 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
49804 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
49805 CHECK_ACCESS(logger_ptr);
49806 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49807 if (logger_conv.free == LDKLogger_JCalls_free) {
49808 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49809 LDKLogger_JCalls_cloned(&logger_conv);
49811 LDKThirtyTwoBytes random_seed_bytes_ref;
49812 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
49813 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
49814 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
49815 int64_t ret_ref = 0;
49816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49819 ret_ref = (uintptr_t)ret_var.inner;
49820 if (ret_var.is_owned) {
49826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
49827 LDKDefaultRouter this_arg_conv;
49828 this_arg_conv.inner = (void*)(this_arg & (~1));
49829 this_arg_conv.is_owned = false;
49830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49831 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
49832 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
49833 return (int64_t)ret_ret;
49836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
49837 LDKChannelManager this_arg_conv;
49838 this_arg_conv.inner = (void*)(this_arg & (~1));
49839 this_arg_conv.is_owned = false;
49840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49841 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
49842 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
49843 return (int64_t)ret_ret;
49846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
49847 LDKStr s_conv = java_to_owned_str(env, s);
49848 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
49849 *ret_conv = SiPrefix_from_str(s_conv);
49850 return (int64_t)ret_conv;
49853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
49854 LDKStr s_conv = java_to_owned_str(env, s);
49855 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
49856 *ret_conv = Invoice_from_str(s_conv);
49857 return (int64_t)ret_conv;
49860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
49861 LDKStr s_conv = java_to_owned_str(env, s);
49862 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
49863 *ret_conv = SignedRawInvoice_from_str(s_conv);
49864 return (int64_t)ret_conv;
49867 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49868 LDKParseError* o_conv = (LDKParseError*)o;
49869 LDKStr ret_str = ParseError_to_str(o_conv);
49870 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49875 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49876 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
49877 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
49878 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49883 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49885 o_conv.inner = (void*)(o & (~1));
49886 o_conv.is_owned = false;
49887 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49888 LDKStr ret_str = Invoice_to_str(&o_conv);
49889 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49894 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49895 LDKSignedRawInvoice o_conv;
49896 o_conv.inner = (void*)(o & (~1));
49897 o_conv.is_owned = false;
49898 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49899 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
49900 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49905 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49906 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
49907 LDKStr ret_str = Currency_to_str(o_conv);
49908 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49913 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49914 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
49915 LDKStr ret_str = SiPrefix_to_str(o_conv);
49916 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49922 LDKRapidGossipSync this_obj_conv;
49923 this_obj_conv.inner = (void*)(this_obj & (~1));
49924 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
49925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49926 RapidGossipSync_free(this_obj_conv);
49929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
49930 LDKNetworkGraph network_graph_conv;
49931 network_graph_conv.inner = (void*)(network_graph & (~1));
49932 network_graph_conv.is_owned = false;
49933 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
49934 LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
49935 int64_t ret_ref = 0;
49936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
49937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
49938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49939 ret_ref = (uintptr_t)ret_var.inner;
49940 if (ret_var.is_owned) {
49946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1sync_1network_1graph_1with_1file_1path(JNIEnv *env, jclass clz, int64_t this_arg, jstring sync_path) {
49947 LDKRapidGossipSync this_arg_conv;
49948 this_arg_conv.inner = (void*)(this_arg & (~1));
49949 this_arg_conv.is_owned = false;
49950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49951 LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
49952 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
49953 *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
49954 return (int64_t)ret_conv;
49957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
49958 LDKRapidGossipSync this_arg_conv;
49959 this_arg_conv.inner = (void*)(this_arg & (~1));
49960 this_arg_conv.is_owned = false;
49961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49962 jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
49966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49967 if ((this_ptr & 1) != 0) return;
49968 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
49969 CHECK_ACCESS(this_ptr_ptr);
49970 LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
49971 FREE((void*)this_ptr);
49972 GraphSyncError_free(this_ptr_conv);
49975 static inline uintptr_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
49976 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
49977 *ret_copy = GraphSyncError_clone(arg);
49978 int64_t ret_ref = (uintptr_t)ret_copy;
49981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49982 LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)arg;
49983 int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
49987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49988 LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)orig;
49989 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
49990 *ret_copy = GraphSyncError_clone(orig_conv);
49991 int64_t ret_ref = (uintptr_t)ret_copy;
49995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
49996 LDKDecodeError a_conv;
49997 a_conv.inner = (void*)(a & (~1));
49998 a_conv.is_owned = (a & 1) || (a == 0);
49999 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50000 a_conv = DecodeError_clone(&a_conv);
50001 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50002 *ret_copy = GraphSyncError_decode_error(a_conv);
50003 int64_t ret_ref = (uintptr_t)ret_copy;
50007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
50008 LDKLightningError a_conv;
50009 a_conv.inner = (void*)(a & (~1));
50010 a_conv.is_owned = (a & 1) || (a == 0);
50011 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50012 a_conv = LightningError_clone(&a_conv);
50013 LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50014 *ret_copy = GraphSyncError_lightning_error(a_conv);
50015 int64_t ret_ref = (uintptr_t)ret_copy;
50019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data) {
50020 LDKRapidGossipSync this_arg_conv;
50021 this_arg_conv.inner = (void*)(this_arg & (~1));
50022 this_arg_conv.is_owned = false;
50023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50024 LDKu8slice update_data_ref;
50025 update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
50026 update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
50027 LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50028 *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
50029 (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
50030 return (int64_t)ret_conv;